Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)

Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual426750-001
6-72
SEND Statement
Consider the following example of the SEND statement:
77 YEARLY-REVIEW PIC 999 VALUE 3.
:
MOVE YEARLY-REVIEW TO TRANSCODE OF HEADER.
SEND HEADER, LASTNAME OF PERSONAL-REC TO "SALARY-UPDATE"
REPLY CODE 1 YIELDS R-CODE, NEW-SALARY-CODE
CODE 2 YIELDS R-CODE, NEW-SALARY, STOCK-OPTION
CODE 0 YIELDS R-CODE, TERMINATION-NOTICE
ON ERROR PERFORM SERVER-DUMB.
The example is executed as follows:
1. The transaction message is constructed using the values of HEADER and
LASTNAME from the SCREEN COBOL program data area. This message is sent
to a server process of the server class SALARY-UPDATE, and the requester waits
for a reply.
2. When the reply arrives, the reply is identified and moved into NEW-SALARY-
CODE, NEW-SALARY and STOCK-OPTION, or TERMINATION-NOTICE,
depending on the reply code. The number moved into special register
TERMINATION-STATUS will be 1, 2, or 3, depending on the reply code received
from the server.
3. The ON ERROR clause takes special action if a problem occurs in sending the
message. The possible problems include a freeze on the server class, the
unavailability of an appropriate server, and an unrecognizable reply from the server.
If such a condition arises, TERMINATION-STATUS is set to a value indicating the
type of error, and the imperative statement PERFORM SERVER-DUMB is
executed.
4. If the ON ERROR clause had not been included and an error occurred, the standard
system action would be performed (see Sending to an External PATHMON Process
on page 6-76 for a list of SEND ERROR numbers)
Variable Reply Length
The ON ERROR clause prevents the requester from being suspended when the reply
length does not match the YIELDS buffer length. In this case, when the TCP executes
the ON ERROR clause, it aslo sets the SCREEN COBOL special registers
TERMINATION-STATUS and TERMINATION-SUBSTATUS as follows:
TERMINATION-STATUS = 11
TERMINATION-SUBSTATUS = min (<rcvlen>,
1 + max(<sndlen>,<maxyldlen>) )
where <rcvlen> = actual length of message from server, <sndlen> = length of message
sent to server, <maxyldlen> = longest total reply area of any YIELDS clause in this
SEND verb.