Pathway/iTS TCP and Terminal Programming Guide

Processing Unsolicited Messages
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
7-9
ESCAPE ON UNSOLICITED MESSAGE Design
Considerations
ESCAPE ON UNSOLICITED MESSAGE Design Considerations
When writing an application that uses ESCAPE ON UNSOLICITED MESSAGE
clauses, you have several design considerations.
When using the interrupt method, if there is a chance that a UMP message might get
canceled, it is recommended that a check to the PW-UNSOLICITED-MESSAGE-
QUEUE be made before executing the RECEIVE UNSOLICITED MESSAGE verb.
This prevents the SCREEN COBOL program from indefinitely waiting on the
RECEIVE UNSOLICITED MESSAGE verb when the UMP message that caused the
interrupt is canceled before the RECEIVE UNSOLICITED MESSAGE verb is
executed.
Example 7-2. UMP and the SEND MESSAGE Statement
SEND-MESSAGE-AND-RECEIVE-REPLY.
SEND MESSAGE request-message
REPLY CODE "AA" YIELDS aa-reply
ESCAPE ON UNSOLICITED MESSAGE
TIMEOUT five-minutes
ON ERROR GO TO analyze-error.
PERFORM ONE OF aa-reply
unsolicited-message-arrival
DEPENDING ON TERMINATION-STATUS.
GO TO send-message-and-receive-reply.
AA-REPLY.
* TERMINATION-STATUS = 1. This is a normal (expected)
completion.
* Do whatever is appropriate for an AA-type reply and then
resume
* regular processing.
UNSOLICITED-MESSAGE-ARRIVAL.
* TERMINATION-STATUS = 2. The statement was interrupted by
the
* arrival of an unsolicited message.
*
* If CONTROL 26 is enabled, at this point you should check
* TERMINATION-SUBSTATUS for the values 187, 188, or 189.
*
* If CONTROL 26 is not enabled, you should check
* TERMINATION-SUBSTATUS for the value 0.
IF PW-UNSOLICITED-MESSAGE-QUEUED IS EQUAL TO "YES"
PERFORM process-unsolicited-message
UNTIL PW-UNSOLICITED-MESSAGE-QUEUED IS EQUAL TO "NO".
PROCESS-UNSOLICITED-MESSAGE.
RECEIVE UNSOLICITED MESSAGE
YIELDS unsolicited-statistics-request.
* Gather the requested statistics and format a reply message.
REPLY TO UNSOLICITED MESSAGE requested-statistics.