Coding the input procedure
To process the records in an input file before they are
released to the sort program, use the
phrase of the format 1
You can use an input procedure to:
- Release data items to the sort file from
- Release records that have already been read elsewhere in the program.
- Read records from an input file, select or process them, and release them to the sort file.
Each input procedure must be contained in either paragraphs
or sections. For example, to release records from a table in
the sort file
SORT-WORK-2, you could code as follows:
ON ASCENDING KEY SORT-KEY
INPUT PROCEDURE 600-SORT3-INPUT-PROC
. . .
PERFORM WITH TEST AFTER
VARYING X1 FROM 1 BY 1 UNTIL X1 = 100
RELEASE SORT-WORK-2-AREA FROM TABLE-ENTRY (X1)
transfer records to the sort program, all input procedures must contain
at least one
RELEASE FROM statement.
To release A from X, for example, you can code:
MOVE X TO A.
Alternatively, you can code:
RELEASE A FROM X.
The following table compares the