You can monitor for status messages that are sent by the commands in your CL procedure or by the programs or procedures it calls.
Status messages tell your procedure the status of the work performed by the sender. By monitoring for status messages, you can prevent the sending program or procedure from proceeding with any more processing.
No message information is stored in a message queue for status messages. Therefore, a status message cannot be received.
If a status message is not monitored for, it is percolated like escape and notify messages are. If the activation group boundary is reached without a Monitor Message (MONMSG) command being found, action on the message is considered complete and control is returned to the sender of the message to continue processing. Status messages are often sent to communicate normal conditions that have been detected where processing can continue.
Status messages sent to the external message queue are shown on the interactive display, informing the user of a function in progress. For example, the Copy File (CPYF) command sends a message informing the user that a copy operation is in progress.
Only predefined messages can be sent as status messages; immediate messages cannot be sent. You can use the system-supplied message ID, CPF9898, and supply message data to send a status message if you do not have an existing message description.
When the function is completed, your procedure or program should remove the status message from the interactive display. The message cannot be removed using a command, but sending another status message to *EXT with a blank message gives the appearance of removing the message. The system-supplied message ID CPI9801 can be used for this purpose. When control returns to the i5/OS™ program, the *STATUS message may be cleared from line 24, without sending the CPI9801 message. The following example shows a typical application of message IDs CPF9898 and CPI9801:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + MSGDTA('Function xxx being performed') + TOPGMQ(*EXT) MSGTYPE(*STATUS) • • /* Your processing function */ • SNDPGMMSG MSGID(CPI9801) MSGF(QCPFMSG) + TOPGMQ(*EXT) MSGTYPE(*STATUS)