In this topic, we described about the below sections -
The datasets used in SORT for processing and its DD statements, coding rules are specified below.
Input datasets - SORTIN and SORTINnn
Input datasets contains the data to be process by DFSORT.DFSORT input dataset referred with the DD name SORTIN. The input datasets can be specified in two ways.
- Input for Sorting or Copying
These datasets specified with SORTIN DD statement.
- Input for Merging.
These datasets specifed with SORTINnn DD statement.
SORTIN, SORTINnn DD statement used to specify one or multiple input datasets.If SORTIN DD statement is present, then it specifies that by default Sorting or Copying process in effect.
The SORTINnn DD statements is present, then it specifies that by default Merge process in effect.In SORTINnn, nn can be from 00 to 99. i.e, At max 100 datasets can be specified in Merge process.
For Copying or Sorting process, avoid using the same dataset name for SORTIN and SORTOUT to restrict unpredictable results.For Sort process, the SORTIN data set should not be the same as any SORTWKnn data set. FREE=CLOSE cannot be specified.
Output datasets - SORTOUT and OUTFIL
Output datasets are the datasets where the DFSORT processed data will store. DFSORT output referred with name SORTOUT DD statement if no OUTFIL specified.
If OUTFIL specified, then the final output would be stored in OUTFIL datasets.The output datasets can be specified in three ways in DFSORT.
- Single output file with SORTOUT. If no OUTFIL coded, the output dataset can be specified with SORTOUT DD Statement.
- Single output file with OUTFIL. This can be acheived by specifying single OUTFIL statement.
- Multiple output files with OUTFIL. This can be done by specifying mutltiple OUTFIL statements.
SORTOUT DD statement will be coded to generate single non-split output file during Sort, Copy, or Merge process. If SORTOUT DD statement is present, it will be used by default for a Sort, Copy, or Merge process.
The FNAMES and FILES parameters of one/more OUTFIL statements specify the DDnames of the OUTFIL data sets for Sort, Copy, or Merge process.
The individual OUTFIL statement parameters defines the OUTFIL processing to be performed on the OUTFIL datasets associated with that DDname. Each DDname specified in OUTFIL statement must have a corresponding DD statement.
WORK data sets -SORTWKdd
The SORTWKdd datasets used as intermediate storage areas for DFSORT records processing.Up to 255 SORTWK datasets can be specified for intermediate process.
If block set technique is not used and more than 32 datasets coded, only first 32 will be used during the sorting. SORTWKdd data sets can be on disk or on tape, but not both. SORTWKdd datsets disk types can be mixed.
In SORTWKdd, "dd" value can be a combination of numeric and alphabets.One or more SORTWKdd statements are required for sorting process (not for merge or copy), unless:
- Input contains in main storage.
- Dynamic work space allocation has been requested (DYNALLOC).
In SORWKdd, it wont treat the DD names are duplicate until two DD names are exactly equal. If SORTWKdd used disk work area as intermediate storage and DFSORT terminates unsuccessfully, the intermediate storage will also get released.
//SORTWK01 DD SPACE=(CYL,(15,5)),UNIT=3390
If SORTWKdd used disk work area as intermediate storage and the job needs the intermediate storage allocated to remain if the job completed with error then the DISP parameter needs to coded like below.
//SORTWK01 DD SPACE=(CYL,(15,5)),UNIT=3390,DISP=(NEW,DELETE,CATLG)
If SORTWKdd used tape as intermediate storage and DFSORT terminates unsuccessfully, the intermediate storage data sets remain in the system until the step has been successfully rerun or until the data sets have been deleted by some other way.
//SORTWK01 DD UNIT=3390,LABEL=(,NL)
- Input datasets can be blocked or unblocked QSAM or VSAM dataset if using for Sorting or Copying.
- Input datasets can be up to 100 blocked or unblocked QSAM or VSAM datasets if using for Merging.
- The Datasets can contain fixed or variable-length records.
- QSAM input datasets can be concatenated even if they are on different devices.
- Output dataset can be blocked or unblocked QSAM or VSAM data sets regardless of input dataset type.
- OUTFIL can be used to convert variable length input to fixed length output, or fixed length input to variable length output.
- If OUTFIL used, an output dataset must be the same type (fixed or variable) as input dataset.
The maximum record length DFSORT can handle based on the type of the files like below:
- Record length coded should not exceed the maximum record length.
- Variable-length records are limited to 32756 bytes.
- VSAM variable-length records are limited to 32752 bytes.
- Fixed-length records are limited to 32760 bytes.
- Variable block-spanned records are limited to 32767 bytes.
- For tape work dataset sorting, the maximum record length is limited to 32752 bytes with NOEQUALS in effect and to 32748 bytes with EQUALS in effect.