Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-133
TRANSFORM Statement
01 WS-DESTINATION-TEMP-1.
05 WS-DEST-1-FLD1 PIC X(50).
05 WS-DEST-1-FLD2 PIC X(50).
01 WS-DESTINATION-TEMP-2.
05 WS-DEST-2-FLD1 PIC X(30).
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