Previous Topic: MSGPROC Statements

Next Topic: Messages from MSGPROC

Design MSGPROC Procedures

You write an MSGPROC procedure as a closed loop. When invoked, it processes until the first &MSGREAD statement is detected again and then suspends processing until a message arrives for your terminal.

As each message arrives, the procedure logic branches to an appropriate processing point for that message, or issue an &MSGCONT if the message is of no interest. After processing the message or a group of associated messages, the procedure then returns to the initial &MSGREAD where processing is suspended once again.

If the logic of the MSGPROC procedure allows it to terminate, an error message is issued and normal message processing resumes.

MSGPROC can also use the START command to create worker processes that process events or message groups asynchronously. This lets MSGPROC continue monitoring the flow of OCS window messages.