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-71
SEND Statement
Use of Reply Codes and Termination Status
A message containing a variable-length data item cannot be easily decomposed by a
server written in COBOL; the only exception is when the variable-length data item is
the last item of the message.
If a server is to process more than one type of message, a data item of the message
should contain a field that identifies the type of transaction unless the content of the data
itself determines the transaction type.
Specifying reply-code-value after the CODE keyword identifies the structure of
the reply. When the send operation receives the reply from the server, the first two
bytes are interpreted as a 16-bit integer. This code must match one of the CODE reply
code values. The entire reply is then distributed to the items in the identifier-2
list associated with reply-code-value. The special register TERMINATION-
STATUS is set to a number corresponding to the position of the particular reply code
value in the list, providing the TCP did not find an error while executing the SEND
statement.
Each reply-code-value corresponds to a unique number setting for
TERMINATION-STATUS whether or not a reply code value yields the same Working-
Storage data item. If there is no match or if the reply message data does not exactly fill
the data items in the identifier-2 list, an error is indicated.
In the SEND statement, the position of a reply code affects the value set for the
TERMINATION-STATUS special register as illustrated in the following example:
SEND HEADER, LASTNAME OF EMP-REC TO "PERS-DEPT"
REPLY CODE 1, 21, 31 YIELDS R-CODE, NEW-SALARY
CODE 2, 42, 62 YIELDS NEW-RATE, STOCK-OPTION, BENEFIT
CODE 0, 200 YIELDS TERMINATION-NOTICE
ON ERROR PERFORM SERVER-LIST.
In this example, the positions of the reply codes cause these corresponding values to be
set for TERMINATION-STATUS:
Reply Code TERMINATION-STATUS
11
21 2
31 3
24
42 5
62 6
07
200 8