REPLY_INQUIRY_MESSAGES scalar function

The REPLY_INQUIRY_MESSAGES scalar function replies to one or more inquiry messages in the QSYSOPR message queue.

This function extends what can be done by the Send Reply (SNDRPY) CL command.

Authorization: See Note below.

Read syntax diagramSkip visual syntax diagram REPLY_INQUIRY_MESSAGES ( MESSAGE_ID =>  message_id ,SEARCH_MESSAGE_TEXT => search-message_text,RESPONSE => response,REMOVE_MESSAGE => remove-message )
The schema is SYSTOOLS.
message-id
A character string containing the message identifier of the inquiry message. The special value *IMMED can be specified to indicate the message has no message identifier.
search-message-text
A character string containing a string that must exist in the message text in order for the inquiry message to be selected. The comparison is case insensitive.
When message-id is *IMMED, a value must be specified. Otherwise, a value is optional.
response
A character string containing the response to be provided to any inquiry messages that meet the message-id and search-string criteria.
If response is omitted or contains the value *DFT, the default reply stored in the message description of the inquiry message is sent as the reply, or the system default reply of *N is used.
remove-message
A character string that indicates whether the inquiry message and its reply are removed from the message queue.
NO
The message will not be removed.
YES
The message will be removed. This is the default.
The result of the function is an integer that indicates the number of inquiry messages that were responded to.

Note

This function is provided in the SYSTOOLS schema as an example of how to respond to inquiry messages in the QSYSOPR message queue using an SQL scalar function. Similar to other Db2® for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or to create a customized version within a user-specified schema.

Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces used to implement the service. To understand the authority requirements, extract the SQL for the service and examine the implementation.

Examples

  • Respond to any inquiry messages for message identifier CPA7025. Leave the messages in the message queue.
     VALUES SYSTOOLS.REPLY_INQUIRY_MESSAGES(
                                 MESSAGE_ID => 'CPA7025',
                                 RESPONSE => 'I',
                                 REMOVE_MESSAGE => 'NO'
                                  );
  • Respond to any impromptu inquiry messages containing the text string 'restore'.
     VALUES SYSTOOLS.REPLY_INQUIRY_MESSAGES(
                                 MESSAGE_ID => '*IMMED'
                                 SEARCH_MESSAGE_TEXT => 'restore',
                                 RESPONSE => 'CONTINUE',
                                 REMOVE_MESSAGE => 'YES'
                                  );