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

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-134
TRANSFORM Statement
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
DESTINATION-TEMP-1. If the select code is 64 or 74, TRANSFORM sends the
data through DESTINATION-TEMP-2.
TRANSFORM moves a number from 1 to 4 into the TERMINATION-STATUS
register depending on the position of the select code relative to the other possible
select codes.
°
If there are no errors, the TERMINATION-STATUS special register is set as
follows:
°
If TRANSFORM detects an error, it sets TERMINATION-STATUS to a value
that indicates the type of error and performs the procedure ERROR-
HANDLER.
In the following example TRANSFORM looks for the select code 30 bytes from the
beginning of the input record. The position of the
code-field
, WS-SEL-CODE-
FIELD, in the Working-Storage record WS-CODE-MSG defines this offset. Also,
notice that the select codes are specified in Working-Storage data items SC1 and SC2
rather than with numeric literals.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-SOURCE PIC X(102).
01 WS-CODE-MSG.
05 PREFIX PIC X(30).
05 WS-SEL-CODE-FIELD PIC 9(4) COMP.
01 REPLY CODES.
05 SC1 PIC 9(4) COMP, VALUE IS 1.
05 SC2 PIC 9(4) COMP, VALUE IS 2.
01 WS-DESTINATION-TEMP-1.
05 WS-DEST-1-FLD1 PIC X(30).
05 WS-DEST-2-FLD2 PIC X(20).
05 WS-DEST-1-FLD3 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).
Select Code TERMINATION-STATUS
44 1
54 2
64 3
74 4