Pathway/iTS TCP and Terminal Programming Guide
Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide—426751-001
6-11
Example 2: Assembling Output Messages
Example 2: Assembling Output Messages
The next example uses a TRANSFORM statement to gather a set of data values from
diverse locations in working storage, to convert them from one format to another, and to
assemble them into a completely different field structure to form a single record. That
record will subsequently be sent, through a SEND statement, to a server process.
Assume that the source data structures in working storage are DATA-RECORD-1,
DATA-RECORD-2, and DATA-RECORD-3, and the target data structure is
SERVER-RECORD-1.
01 DATA-RECORD-1.
05 DATA-FLD-A PIC A(10).
05 DATA-FLD-B PIC 9(10).
01 DATA-RECORD-2.
05 DATA-FLD-C PIC 9(3).
05 DATA-FLD-D PIC A(5). 54 bytes total
05 DATA-FLD-E PIC A(5).
01 DATA-RECORD-3.
05 DATA-FLD-F PIC X(10).
05 DATA-FLD-G PIC A(5).
05 DATA-FLD-H PIC X(6).
01 SERVER-RECORD-1.
05 SRVR-FLD-1 PIC X(21).
05 SRVR-FLD-2 PIC 9.
05 SRVR-FLD-3 PIC 9. 54 bytes total
05 SRVR-FLD-4 PIC 9.
05 SRVR-FLD-5 PIC A(10).
05 SRVR-FLD-6 PIC X(20).
Then assume that the program must transmit the data from the following sequence of
source fields to the server process:
DATA-FLD-A
DATA-FLD-H
DATA-FLD-G
DATA-FLD-C
DATA-FLD-D DATA-RECORD-2
DATA-FLD-E
DATA-FLD-B
DATA-FLD-F
Notice that the first three and last two fields are from the structures DATA-RECORD-1
and DATA-RECORD-3. Not only are they separated from one another in the target
record, but also they appear in a different order from that defined for them in the DATA-
RECORD-1 and DATA-RECORD-2 Working-Storage Section definitions. You,
therefore, must refer to those fields by their elementary data-item names when
specifying where the data to be transformed is coming from.
In contrast, because the fourth, fifth, and sixth fields are all from the data structure
DATA-RECORD-2 and appear in the same order as the one defined for that structure in
working storage, you can refer to them collectively by their shared 01-level name.