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

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-40
DIALOG-BEGIN
Use of Reply Codes and Termination Status
Specifying
reply-code-value
after the CODE keyword identifies the structure of the
reply. When the DIALOG-BEGIN operation receives the reply from the server, the first
two bytes are interpreted as 16-bit integer. The 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 the
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, provided the TCP does not encounter an error while running the
DIALOG-BEGIN 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 DIALOG-BEGIN statement, the position of a reply code affects the value set for the
TERMINATION-STATUS special register as illustrated in this example:
DIALOG-BEGIN 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:
Consider this example of the DIALOG-BEGIN statement:
77 YEARLY-REVIEW PIC 999 VALUE 3.:
MOVE YEARLY-REVIEW TO TRANSCODE OF HEADER.
DIALOG-BEGIN 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.
Reply Code Termination Status
1 1
21 2
31 3
2 4
42 5
62 6
0 7
200 8