FASTSRT requirements for sort input and output files
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.
sort input and output filesthat is described in this topic relates to the format 1
SORT
statement only. To
use FASTSRT
, you must describe and process the input
files to the sort and the output files from the sort in these ways:
- You can name only one input file in the
USING
phrase. You can name only one output file in theGIVING
phrase. - You cannot use an input procedure on an input file nor an output
procedure on an output file.
Instead of using input or output procedures, you might be able to use these DFSORT control statements:
INREC
OUTFILE
OUTREC
INCLUDE
OMIT
STOPAFT
SKIPREC
SUM
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.
- Do not code the
LINAGE
clause for the outputFD
entry. - Do not code any
INPUT
declarative (for input files),OUTPUT
declarative (for output files), or file-specific declaratives (for either input or output files) to apply to anyFD
s used in the sort. - Do not use a variable relative file as the input or output file.
- Do not use a line-sequential file as the input or output file.
- For either an input or an output file, the record descriptions
of the
SD
andFD
entry must define the same format (fixed or variable), and the largest records of theSD
andFD
entry must define the same record length.
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.
QSAM requirements
- QSAM files must have a record format of fixed, variable, or spanned.
- A QSAM input file can be empty.
- To use the same QSAM file for both input and output, you must
describe the file using two different
DD
statements. For example, in theFILE-CONTROL SECTION
you might code this:SELECT FILE-IN ASSIGN INPUTF. SELECT FILE-OUT ASSIGN OUTPUTF.
In the
DATA DIVISION
, you would have anFD
entry for bothFILE-IN
andFILE-OUT
, whereFILE-IN
andFILE-OUT
are identical except for their names.In the
PROCEDURE DIVISION
, yourSORT
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
andGIVING
phrases, or assign the input and output files the same ddname, then the file can be accepted forFASTSRT
either for input or output, but not both. If no other conditions disqualify the file from being eligible forFASTSRT
on input, then the file will be accepted forFASTSRT
on input, but not on output. If the file was found to be ineligible forFASTSRT
on input, it might be eligible forFASTSRT
on output.
A QSAM file that qualifies for FASTSRT
can
be accessed by the COBOL program while the format
1 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.
VSAM requirements
- A VSAM input file must not be empty.
- VSAM files cannot be password-protected.
- You cannot name the same VSAM file in both the
USING
andGIVING
phrases. - A VSAM file that qualifies for
FASTSRT
cannot be accessed by the COBOL program until the format 1SORT
statement processing is completed. For example, if the file qualifies forFASTSRT
on input, you cannot access it in an output procedure and vice versa. (If you do so,OPEN
fails.)
DFSORT Application Programming Guide