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

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-91
REPLY TO UNSOLICITED MESSAGE Statement
SEND MESSAGE REPLY YIELDS MESSAGE-IN.
:
REPLY TO UNSOLICITED MESSAGE Statement
The REPLY TO UNSOLICITED MESSAGE statement sends a reply to a message
previously received by a RECEIVE UNSOLICITED MESSAGE statement. After a
RECEIVE UNSOLICITED MESSAGE statement is issued, all other RECEIVE
UNSOLICITED MESSAGE statements are rejected as errors and all ESCAPE ON
UNSOLICITED MESSAGE clauses are disallowed until a REPLY TO UNSOLICITED
MESSAGE statement is executed.
reply-message
identifies an 01 level message field in the Message Section or an 01 or 77 level
data item in the Working-Storage Section. The
reply-message
contains data to
be sent in response to a previously received unsolicited message.
ON ERROR
imperative-stmt
specifies action to be taken should an error occur in sending the message. If an
error occurs,
imperative-stmt
is executed. The TERMINATION-STATUS
special register contains a value indicating the cause.
Consider the following SCREEN COBOL example that uses the REPLY TO
UNSOLICITED MESSAGE statement:
PROCEDURE DIVISION.
MESSAGE-RESPONSE.
REPLY TO UNSOLICITED MESSAGE WITH MY-REPLY
ON ERROR PERFORM ERROR-HANDLER.
ERROR-HANDLER.
IF TERMINATION-STATUS = 1
PERFORM ANALYZE-GUARDIAN-ERROR
ELSE
PERFORM ANALYZE-ERROR.
The REPLY TO UNSOLICITED MESSAGE statement executes as follows:
1. The statement sends the contents of MY-REPLY in response to the last unsolicited
message.
2. If there is an error, ERROR-HANDLER is performed. If there is a file system error,
the TERMINATION-STATUS register contains a 1 and the TERMINATION-
SUBSTATUS register contains the error number; otherwise, TERMINATION-
STATUS contains the error number.
REPLY [ TO ] UNSOLICITED [ MESSAGE ] [ WITH ]
reply-message
[ ON ERROR
imperative-stmt
]