SEND_DATA_QUEUE, SEND_DATA_QUEUE_BINARY, and SEND_DATA_QUEUE_UTF8 procedures

The SEND_DATA_QUEUE, SEND_DATA_QUEUE_BINARY, and SEND_DATA_QUEUE_UTF8 procedures send a message to the specified data queue. The message data can be sent as character, UTF-8, or binary data.

This procedure provides function similar to the Send Data Queue (QSNDDTAQ) API.

Authorization: The caller must have:
  • *EXECUTE authority to the library containing the data queue, and
  • *OBJOPR and *ADD authority to the data queue.
Read syntax diagramSkip visual syntax diagramSEND_DATA_QUEUESEND_DATA_QUEUE_BINARYSEND_DATA_QUEUE_UTF8( MESSAGE_DATA => message-data,DATA_QUEUE => data-queue,DATA_QUEUE_LIBRARY => data-queue-library,KEY_DATA => key-data,ASYNCHRONOUS => asynchronous )

The schema is QSYS2.

message-data
The data to send to the message queue. The string can be up to 64512 characters long.
  • For SEND_DATA_QUEUE, the input value will be converted to a character string with the job CCSID.
  • For SEND_DATA_QUEUE_BINARY, the input value will be converted to a binary string.
  • For SEND_DATA_QUEUE_UTF8, the input value will be converted to a UTF-8 string.
data-queue
A character or graphic string containing the name of the data queue.
data-queue-library
A character or graphic string containing the name of the library containing the data queue. Can be one of the following special values:
*CURLIB
The job's current library is used.
*LIBL
The library list is used. This is the default.
key-data
A character string containing the key data to send to the data queue. This parameter is required for a keyed data queue. It must not be specified for a non-keyed data queue.
The length of the key must match the length specified on the KEYLEN parameter on the Create Data Queue (CRTDTAQ) command.
asynchronous
Indicates whether the send request to a DDM data queue should be processed asynchronously. Valid values are:
NO
The request should not be processed asynchronously. This is the default.
YES
The request should be processed asynchronously. This can only be specified for a DDM data queue.
If an error occurs during an asynchronous operation, the error will not be detected until the next time the data queue is accessed synchronously.

Example

Send a message to data queue DQ1 in TESTLIB with key 456.

CALL QSYS2.SEND_DATA_QUEUE(MESSAGE_DATA => 'This is the message data',
                                    DATA_QUEUE => 'DQ1', 
                                    DATA_QUEUE_LIBRARY => 'TESTLIB', 
                                    KEY_DATA => '456');