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
USINGphrase. You can name only one output file in theGIVINGphrase. - 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:
INRECOUTFILEOUTRECINCLUDEOMITSTOPAFTSKIPRECSUM
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
LINAGEclause for the outputFDentry. - Do not code any
INPUTdeclarative (for input files),OUTPUTdeclarative (for output files), or file-specific declaratives (for either input or output files) to apply to anyFDs 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
SDandFDentry must define the same format (fixed or variable), and the largest records of theSDandFDentry 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
DDstatements. For example, in theFILE-CONTROL SECTIONyou might code this:SELECT FILE-IN ASSIGN INPUTF. SELECT FILE-OUT ASSIGN OUTPUTF.In the
DATA DIVISION, you would have anFDentry for bothFILE-INandFILE-OUT, whereFILE-INandFILE-OUTare identical except for their names.In the
PROCEDURE DIVISION, yourSORTstatement could look like this:SORT file-name ASCENDING KEY data-name-1 USING FILE-IN GIVING FILE-OUTThen in your JCL, assuming that data set
INOUThas been cataloged, you would code://INPUTF DD DSN=INOUT,DISP=SHR //OUTPUTF DD DSN=INOUT,DISP=SHROn the other hand, if you code the same file-name in the
USINGandGIVINGphrases, or assign the input and output files the same ddname, then the file can be accepted forFASTSRTeither for input or output, but not both. If no other conditions disqualify the file from being eligible forFASTSRTon input, then the file will be accepted forFASTSRTon input, but not on output. If the file was found to be ineligible forFASTSRTon input, it might be eligible forFASTSRTon 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
USINGandGIVINGphrases. - A VSAM file that qualifies for
FASTSRTcannot be accessed by the COBOL program until the format 1SORTstatement processing is completed. For example, if the file qualifies forFASTSRTon input, you cannot access it in an output procedure and vice versa. (If you do so,OPENfails.)
DFSORT Application Programming Guide