You can specify an output file or an output procedure to indicate how the sorted records are to be returned from the SORT utility.
If an output file is specified, SORT invokes a standard output procedure that writes the sorted records to the output file. For efficiency, the output file should be blocked in increments greater than 500 words and should contain approximately 100 (or more) records per block. The output file must be closed when it is passed to SORT. The file is closed after the SORT statement is completed.
If you specify an output procedure, the procedure is called once for each sorted record and once for the end of output action. The output procedure must not contain any SORT or MERGE statements.