Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Refer also to the companion MSGQ_RECEIVE and MSGQ_SEND activities that allows you to send and receive single messages to or from a named message queue.  Refer to IBM i documentation concerning message queues, message descriptions and message files for further information about the operating system features upon which this activity depends.

...


Note
iconfalse
titleNote

Unlike many other iterator activities, this activity will iterate indefinitely unless you take specific action in the iterator block to exit the iteration.  It is designed to be used in a potentially long running processing sequence that perpetually waits on a message arriving at the specified message queue and then processes the message or initiates another processing sequence to process the message.  For more information refer to Considerations for Extended Duration Processing Sequences .

INPUT Parameters:

MSGQ: Required

This parameter must specify the name of the message queue from which the messages are to be received.

MSGQLIB: Optional

This parameter specifies the name of the library containing the message queue.  If not specified, a default of *LIBL is used which means the library list is used to locate the named message queue.

MSGWAIT: Optional

Specifies the length of time (in seconds) that the activity will wait, on each iteration, for a message to arrive in the message queue.

...

The special value *MAX means that the activity waits indefinitely for a message to arrive.  Use of this value is not generally recommended with the WATCH_MSGQ activity as it will prevent any possibility of using a controlled end to the processing sequence.

MSGRMV: Optional

Specifies whether each message received by the activity is removed from the message queue.  The default is *YES, which means the message is removed.  *NO causes the message not to be removed from the message queue.  If you do so, the system considers the message to be "old" and it will not be received again by this activity.  If your processing sequence leaves "old" messages on the message queue, it is your responsibility to remove them by other means such as by executing the CLRMSGQ operating system command.

OUTPUT Parameters:

RCVCOUNT:

The received message count.    Upon each iteration, if data is received successfully, the value will be one (1).  Otherwise the value will be zero (0). 

RCVMSGSEV:

If a message is received, this parameter contains the severity code of the received message.  Impromptu messages sent by the MSGQ_SEND activity will usually have a severity code of '00'.  For pre-defined messages, the severity code is defined by the message description.

RCVMSGTYPE:

If a message is received, this parameter contains the message type of the received message.  Messages sent by the MSGQ_SEND activity will have a message type of *INFO.  For messages sent by other means, the message type is specified by the sending program.

RCVMSGID:

If a message is received, this parameter contains the message identifier of the received message.  An impromptu message has no message identifier.  Otherwise, this value identifies the message description in the message file identified by the RCVMSGF and RCVMSGFLIB parameters.

RCVMSGF:

If a message is received, this parameter contains the name of the message file of the received message.  An impromptu message has no message file name.  Otherwise, this value identifies the message file name containing the message description used to send the message.

RCVMSGFLIB:

If a message is received, this parameter contains the name of the library containing the message file, if any.

RCVMSGTXT:

If a message is received, this parameter contains the first level message text of the received message.  For a pre-defined message, this includes the message data fields that were substituted for substitution variables in the text before the message was sent.  A maximum of 256 characters of the first level text will be returned.

RCVSECLVL:

If a message is received, this parameter contains the second level message text of the received message, if any.  An impromptu message has no second level message text.  For a pre-defined message, this includes the message data fields that were substituted for substitution variables in the second level text before the message was sent.  A maximum of 256 characters of the second level text will be returned.

RCVMSGDTA:

If a message is received, this parameter contains the message data field values of the received msg.  An impromptu message has no message data.  Otherwise this contains a single string of the message data values used to send the message.  A maximum of 256 characters of message data will be returned.

SENDJOB:

If a message is received, this parameter contains the name of the job that sent the message.

SENDUSER:

If a message is received, this parameter contains the user name of the job that sent the message.

SENDJOBNBR:

If a message is received, this parameter contains the job number of the job that sent the message.

SENDDATE:

If a message is received, this parameter contains the date that the message was sent.  The date is in ISO format - that is, CCYY-MM-DD.

SENDTIME:

If a message is received, this parameter contains the time that the message was sent.  The time is in ISO format - that is, HH:MM:SS.