Input Options

You can specify an input file or an input procedure to indicate how the records are to be provided to the SORT utility.

If an input file is specified, SORT invokes a standard input procedure that opens the file and reads the records. For efficiency, the input file should be blocked in increments greater than 500 words and should contain approximately 50 (or more) records per block. The input file must be closed when it is passed to SORT.

The correct values of the NEWFILE attribute for a file passed to the SORT utility are FALSE for an input file and TRUE for an output file. If the NEWFILE attribute was set to the wrong value, SORT changes it to the correct value before opening the file. This change is necessary when the same file is used for both the input and the output.

If your input procedure is specified as the input option, the procedure is called to provide the input records to SORT. Control is passed to the input procedure before the records are sorted. The records released from the input procedure are then sorted. The input procedure must not contain any SORT or MERGE statements.

SORT programs that contain lengthy input or output procedures can impact other jobs because much of the memory used by SORT is nonoverlayable (save) space. The use of input or output procedures should not be discouraged but should be considered in proper perspective for the job to be accomplished. In some cases, overall system performance can be improved by having the input procedure produce a file that is read by SORT and having SORT produce a file that is processed by the output procedures. The process of calling input or output procedures does not present an excessive burden to SORT or the system.