Use the Send Program Message (SNDPGMMSG) command or the Send User Message (SNDUSRMSG) command to send a message from a CL procedure or program.
Using the SNDPGMMSG command, you can send the following types of messages:
You can send messages from a CL procedure or program to the following types of queues:
To send a message from a procedure or program, you can specify the following on the SNDPGMMSG command:
Message type. The following indicates which types of messages can be sent to which types of queues (V = valid).
Table 8-1. Valid Message Types for Message Queue Types
Message Type | Message Queue Type | ||||
---|---|---|---|---|---|
External | Call | QSYSOPR | Work Station | User | |
Informational | V | V | V | V | V |
Inquiry | V |
| V | V | V |
Completion | V | V | V | V | V |
Diagnostic | V | V | V | V | V |
Request | V | V |
|
|
|
Escape |
| V |
|
|
|
Status | V | V |
|
|
|
Notify | V | V |
|
|
|
To send the message created in Example of Describing a Message, you would use the following command:
SNDPGMMSG MSGID(USR4310) MSGF(QGPL/USRMSG) + MSGDTA(&CUSNO) TOPGMQ(*EXT) + MSGTYPE(*INFO)
The substitution variable for the message is the customer number. Because the customer number varies, you cannot specify the exact customer number in the message. Instead, declare a CL variable in the CL procedure or program for the customer number (&CUSNO). Then specify this variable as the message data field. When the message is sent, the current value of the variable is passed in the message:
Customer number 35500 not found
In addition, you do not always know which display station is using the procedure or program, so you cannot specify the exact display station message queue that the message is to be sent to (TOPGMQ parameter); therefore, you specify the external message queue *EXT.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.