Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-88
RECEIVE UNSOLICITED MESSAGE Statement
A nonnumeric literal must be enclosed within quotation marks.
TIMEOUT
timeout-value
specifies a time limit in seconds that the RECEIVE UNSOLICITED MESSAGE
operation will wait for an unsolicited message. The
timeout-value
can be a
numeric literal or a numeric data item; valid items are 0 through 32,767 seconds.
If the unsolicited message is not received in the specified number of seconds,
TERMINATION-SUBSTATUS is set to 40, the operation is cancelled, and any ON
ERROR clause is executed.
If this clause is omitted, there is no time limit.
ON ERROR
imperative-stmt
specifies action to be taken if an error occurs in receiving the message. If an error
occurs,
imperative-stmt
is executed. The TERMINATION-STATUS special
register contains a value indicating the cause.
The following rules apply:
The RECEIVE UNSOLICITED MESSAGE statement completes immediately if the
unsolicited message queue for the SCREEN COBOL program contains a
message; otherwise, the RECEIVE UNSOLICITED MESSAGE statement will wait
for the arrival of an unsolicited message or a timeout, if a timeout was specified.
The execution of the RECEIVE UNSOLICITED MESSAGE is the beginning step in
processing any unsolicited message. The RECEIVE UNSOLICITED MESSAGE is
executed in the following cases:
1. The ESCAPE ON UNSOLICITED MESSAGE clause of an ACCEPT statement
executes due to the arrival of an unsolicited message.
2. A SEND MESSAGE statement is interrupted and its ESCAPE ON
UNSOLICITED MESSAGE clause is executed.
3. You test the PW-UNSOLICITED-MESSAGE-QUEUED special register and find
it equals YES.
4. The SCREEN COBOL program executes RECEIVE UNSOLICITED
MESSAGE and waits for the arrival of an unsolicited message.
For case 4, you might want to include a TIMEOUT clause if there is a possibility
that the SCREEN COBOL program could wait indefinitely for an unsolicited
message to arrive.
Consider the following SCREEN COBOL example with multiple receive codes:
PROCEDURE DIVISION.
UNSOLICITED-MESSAGE-HANDLER.
RECEIVE UNSOLICITED MESSAGE
CODE RC-1 YIELDS R-MSG-1