Pathway/iTS TCP and Terminal Programming Guide

Handling Errors
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
10-5
Processing Variable-Length Server Replies
This error condition is essentially nonrecoverable. In this case, your ON ERROR code
should send a message to the terminal telling the operator what is happening (such as
SERVER NOT CONFIGURED FOR TMF, TERMINATING EXECUTION), log an
error record to an appropriate server, and then perform a STOP RUN statement.
Processing Variable-Length Server Replies
When your requester is designed to receive variable-length replies from a server, error
code 11 is a normal and common occurrence. In such a case, your ON ERROR code
must be designed to respond to it properly.
Assume that the requester sends a message to a server asking for the names of all
customers that have been added to the database during the past week. In this case, the
response from the server at any given time contains a greater or lesser number of names.
The requester's SEND statement can provide a reply data structure to accommodate a
reasonable maximum number of names. For example, if past performance shows that 10
to 12 new customers are typically added each week and that the best single week yielded
17 new customers, it is reasonable to use a reply data structure that can accommodate up
to 20 customer names.
The code in this case—where the data is shorter than the maximum allowed—looks like
the following. (If the data were longer than the maximum permitted, error 11 would
reflect a nonrecoverable programming error.)
DATA DIVISION.
01 PROCESSING-STATE PIC X(4), VALUE "GO ".
01 NEW-NAME-REQUEST PIC 9(4) comp.
01 NEW-NAME-REPLY.
05 REPLY-CODE PIC 9(4) comp.
05 FUNCTION-CODE PIC 9(4) comp.
* Function-code 1 signifies a new name query.
05 NUMBER-OF-NAMES PIC 9(4) comp.
05 NEW-CUSTOMER-NAMES
PIC X(30) OCCURS 20 TIMES.
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
.
.
PERFORM new-name-query.
Table 10-5. Requester SEND Error for Transaction-Mode Violation
Numeric Value Meaning
13 Transaction-mode violation