If you specify FASTSRT but your code does not meet FASTSRT requirements, the compiler issues a message and the COBOL run time performs the I/O instead. Your program will not experience the performance improvements that are otherwise possible.
To use FASTSRT, you must describe and process the input files to the sort and the output files from the sort in these ways:
Instead of using input or output procedures, you might be able to use these DFSORT control statements:
Many DFSORT functions perform the same operations that are common in input or output procedures. Code the appropriate DFSORT control statements instead, and place them either in the IGZSRTCD or SORTCNTL data set.
If you code a RELATIVE KEY clause for an output file, it will not be set by the sort.
Performance tip: If you block your input and output records, the sort performance could be significantly improved.
SELECT FILE-IN ASSIGN INPUTF. SELECT FILE-OUT ASSIGN OUTPUTF.
In the DATA DIVISION, you would have an FD entry for both FILE-IN and FILE-OUT, where FILE-IN and FILE-OUT are identical except for their names.
In the PROCEDURE DIVISION, your SORT statement could look like this:
SORT file-name ASCENDING KEY data-name-1 USING FILE-IN GIVING FILE-OUT
Then in your JCL, assuming that data set INOUT has been cataloged, you would code:
//INPUTF DD DSN=INOUT,DISP=SHR //OUTPUTF DD DSN=INOUT,DISP=SHR
On the other hand, if you code the same file-name in the USING and GIVING phrases, or assign the input and output files the same ddname, then the file can be accepted for FASTSRT either for input or output, but not both. If no other conditions disqualify the file from being eligible for FASTSRT on input, then the file will be accepted for FASTSRT on input, but not on output. If the file was found to be ineligible for FASTSRT on input, it might be eligible for FASTSRT on output.
A QSAM file that qualifies for FASTSRT can be accessed by the COBOL program while the SORT statement is being performed. For example, if the file is used for FASTSRT on input, you can access it in an output procedure; if it is used for FASTSRT on output, you can access it in an input procedure.
related tasks
DFSORT Application Programming Guide