Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
6-100
TRANSFORM Statement
05 WS-DEST-2-FLD2 PIC X(30).
05 WS-DEST-2-FLD3 PIC X(40).
MESSAGE SECTION.
01 MS-SOURCE PIC X(102) FROM WS-SOURCE.
01 DESTINATION-TEMP-1.
05 FILLER PIC 9(4) COMP.
05 MS-DEST-1-FLD1 PIC X(50) TO WS-DEST-1-FLD1.
05 MS-DEST-1-FLD2 PIC X(50) TO WS-DEST-1-FLD2.
01 DESTINATION-TEMP-2.
05 FILLER PIC 9(4) COMP.
05 MS-DEST-2-FLD1 PIC X(30) TO WS-DEST-2-FLD1.
05 MS-DEST-2-FLD2 PIC X(30) TO WS-DEST-2-FLD2.
05 MS-DEST-2-FLD3 PIC X(40) TO WS-DEST-2-FLD3.
PROCEDURE DIVISON.
TRANSFORM MS-SOURCE
SELECT CODE FIELD IS WS-SEL-CODE-FIELD OF WS-CODE-MSG
CODE 44, 54 YIELDS DESTINATION-TEMP-1
CODE 64, 74 YIELDS DESTINATION-TEMP-2
ON ERROR PERFORM ERROR-HANDLER.
PERFORM ONE OF PROCESS-DEST-TEMP-1
PROCESS-DEST-TEMP-2
DEPENDING ON TERMINATION-STATUS.
This TRANSFORM statement executes as follows:
1. TRANSFORM builds the output record from the data in WS-SOURCE.
TRANSFORM sends this data through MS-SOURCE in the Message Section.
2. TRANSFORM determines the location, length, and type of the code-field,
WS-SEL-CODE-FIELD OF WS-CODE-MSG. The location of this field relative to
the beginning of the Working-Storage record defines the offset of the select code
relative to the beginning of the input record. In this case, WS-SEL-CODE-FIELD is
at the beginning of the Working-Storage record. Therefore, the select code is to be
found at the beginning of the input record.
The SELECT CODE FIELD IS clause could have been omitted in this example
because it specifies the default.
The SELECT CODE FIELD IS clause in the TRANSFORM statement must always
have a Working-Storage Section data item specified as the code-field.
3. The FILLER fields in DESTINATION-TEMP-1 and DESTINATION-TEMP-2 are
place holders for the fields in the input records that contain the select code. These
fields are processed by the TCP and discarded so that they are not stored in
Working-Storage.
4. Because there can be more than one input record, TRANSFORM compares the
contents of the first two bytes of the input record to determine where to send the
data. If the select code is 44 or 54, TRANSFORM sends the data through