Pathway/iTS TCP and Terminal Programming Guide

Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
6-9
Example 1: Disassembling Input Messages
01 CONTROL-RECORD-2.
05 CTL-FLD-2 PIC X(10).
05 CTL-FLD-4 PIC X(10).
01 DATA-RECORD-1.
05 DATA-FLD-A PIC X(10).
05 DATA-FLD-B PIC X(10).
05 DATA-FLD-C PIC X(10).
05 DATA-FLD-D PIC X(10).
05 DATA-FLD-E PIC X(10).
01 DATA-RECORD-2.
05 DATA-FLD-F PIC X(10).
05 DATA-FLD-G PIC X(10).
05 DATA-FLD-H PIC X(10).
Because the type of information (either control information or data) contained in the
message can vary from one transmission to another, there are two levels at which the
requester must process such a message:
1. The requester must first accept the entire message and determine, by checking a
reply code in the transmission header, whether or not the overall message itself was
transmitted and received successfully.
MAIN-PARAGRAPH.
PERFORM send-message-processing
THRU send-message-processing-exit
UNTIL processing-state = "STOP".
MAIN-PARAGRAPH-EXIT.
EXIT.
SEND-MESSAGE-PROCESSING.
SEND MESSAGE msg-out
REPLY CODE 0 YIELDS msg-in
ON ERROR GO TO error-exit.
PERFORM disassemble-message.
GO TO send-message-processing-exit.
ERROR-EXIT.
MOVE "STOP" TO processing-state.
SEND-MESSAGE-PROCESSING-EXIT.
EXIT.