Pathway/iTS TCP and Terminal Programming Guide
Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide—426751-001
6-10
Example 1: Disassembling Input Messages
2. If the reply code in the transmission header indicates successful transmission (0 in
the preceding case), the requester processes the message as either control
information or application data, depending upon the value of the select code within
the message itself. The requester does this by using a TRANSFORM statement as
follows:
DISASSEMBLE-MESSAGE.
TRANSFORM msg-in-data
CODE 1 YIELDS ctl-fld-2, ctl-fld-5, ctl-fld-1
CODE 2 YIELDS control-record-2
CODE 3 YIELDS data-fld-A, data-fld-F, data-fld-C
CODE 4 YIELDS data-record-1
ON ERROR GO TO error-exit.
The TRANSFORM statement is operating upon a subset of the overall message
(MSG-IN-DATA), ignoring the transmission header completely. The statement can
then operate by using a select code defined within that subset of the message; in this
case, by default, the code occurs in the first two bytes of MSG-IN-DATA.
The message string following the select code varies in length and number of fields,
depending upon the value of the select code.
•
If the select code is 1, the TCP extracts three 10-character fields from its input
buffer and stores them in the fields named CTL-FLD-2, CTL-FLD-5, and
CTL-FLD-1 of the Working-Storage data structures CONTROL-RECORD-2
and CONTROL-RECORD-1.
•
If the select code is 2, the TCP extracts two 10-character fields from its input
buffer and stores them in the fields named CTL-FLD-2 and CTL-FLD-4 of the
Working-Storage data structure CONTROL-RECORD-2.
•
If the select code is 3, the TCP extracts three 10-character fields from its input
buffer and stores them in the fields named DATA-FLD-A, DATA-FLD-F, and
DATA-FLD-C of the Working-Storage data structures DATA-RECORD-1 and
DATA-RECORD-2.
•
If the select code is 4, the TCP extracts five 10-character fields from its input
buffer and stores them in the fields named DATA-FLD-A, DATA-FLD-B,
DATA-FLD-C, DATA-FLD-D, and DATA-FLD-E of the Working-Storage
data structure DATA-RECORD-1.
You can specify elementary, group, or 01-level items in the YIELDS lists of the
TRANSFORM statement. You can also intermix these three within the same
YIELDS list.