When an inquiry message is sent, it expects a reply. To allow the sender of an inquiry message to obtain a reply, a sender copy message is issued and associated internally with the inquiry message.
A sender copy message is a copy of the inquiry message that is used by the sender to obtain the reply that is sent to its associated inquiry message. Sending an inquiry and obtaining the reply can be done rather easily when the Send User Message (SNDUSRMSG) command is used in a source program. If the SNDUSRMSG command is not used, the function to send an inquiry and obtain the reply can be done by the Send Program Message (SNDPGMMSG) and Receive Message (RCVMSG) commands in a CL source program. An inquiry can be sent with the SNDPGMMSG command and the reply can be obtained with the RCVMSG command. For example, when an inquiry message is sent with the SNDPGMMSG command, the message reference key (MRK) of the sender copy can be returned on the KEYVAR parameter of the SNDPGMMSG command. The sender copy message is placed on the reply message queue that is specified on the SNDPGMMSG command. When a reply is sent to the inquiry message, internal message handling also sends the same reply to the sender copy message. Then the program can obtain the reply with the RCVMSG command by doing the following tasks: