Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)
Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual—426750-003
6-101
SEND Statement
Unspecified Reply Codes
In the following example a reply code other than 1 or 2 (in the first two bytes of the
reply) causes error 3112 (REPLY NUMBER NOT KNOWN TO PROGRAM) to be
logged, and causes the terminal to be suspended. If a reply code of 1 or 2 is received,
but the reply length does not match the length of rply-1 or rply-2, respectively, error
3115 (TRANSACTION REPLY SIZE INVALID) is logged, and the terminal is
suspended because there is no ON ERROR clause.
SAMPLE-PARAGRAPH-1.
SEND msg-a TO srvr-x
REPLY CODE 1 YIELDS rply-1
CODE 2 YIELDS rply-2.
Occasionally an application may choose not to specify all reply codes. For example,
the following requester accepts any value in the first two bytes of the reply without
logging error 3112.
PERFORM SAMPLE-PARAGRAPH-2.
:
SAMPLE-PARAGRAPH-2.
SEND msg-a TO srvr-x
REPLY CODE OTHER YIELDS VARYING rply-a
ON ERROR
PERFORM ERR-FILTER.
ERR-FILTER.
IF TERMINATION-STATUS = 11 PERFORM var-len-reply-rcd
ELSE PERFORM genuine-reply-error.
VAR-LEN-REPLY-RCD.
MOVE TERMINATION-SUBSTATUS TO rply-length.
GENUINE-REPLY-ERROR.
DISPLAY TERMINATION-STATUS.
This example is executed as follows:
1. Regardless of the actual reply code, if the reply length equals the length of the
Working-Storage item rply-a, the reply is stored in rply-a, and the program
branches back to the paragraph that performed SAMPLE-PARAGRAPH-2.
2. If the reply is shorter than rply-a, the reply is stored in rply-a, the actual length of
the reply is stored in the special register TERMINATION-SUBSTATUS, and the
TERMINATION-STATUS value of 11 causes the program to branch to the
paragraph VAR-LEN-REPLY-RCD.
3. If the reply is longer than rply-a, the reply is truncated to the length of rply-a and
stored in rply-a, TERMINATION-STATUS is set to 11, TERMINATION-
SUBSTATUS is set to the actual reply length up to a maximum of 1 +
max(len(msg-a),len(rply-a)), an error 3115 is logged, and the program branches to
VAR-LEN-REPLY-RCD.










