Receiving request messages is a method for your CL procedure or program to process CL commands.
For example, your procedure or program can obtain input (commands) from a display station and handle the messages that result from the analysis and processing of the input. The commands are sent as request messages so they can be processed. Usually, request messages are received from the external message queue (*EXT) of the job. For batch jobs, the requests received are those read from the input stream. For interactive jobs, the requests received are those the display station user enters one at a time on the Command Entry display. For example, CL commands are requests that are received by the IBM-supplied CL processor QCMD.
Your procedure or program must define the syntax of the data in the request message, interpret the request, and diagnose any errors. While the request is being analyzed or the request function is being run, any number of errors can be detected. As a result of these errors, messages are sent to the call message queue for the procedure or program. The procedure or program handles these messages and then receives the next request message. Thus, a request processing cycle is defined; a request message is received, the request is analyzed and run by your procedure or program with resulting messages displayed, and the next request received. If there are no more request messages to be received in a batch job, an escape message is sent to your procedure or program to indicate this.
More than one OPM program or ILE procedure of a job can receive request messages for processing. The requests received by more recent program calls are considered to be nested within those received by higher level program calls. The request processing cycles at each nesting level are independent of each other. Within an ILE program, one or more procedures within that program can be receiving request messages. If more than one procedure is processing requests then the nesting occurs within the same ILE program and the nesting levels remain independent.
The following diagram shows how request messages are processed by QCMD: