DFSORT Datasets and RulesDFSORT DD statements and parameters DFSORT CONTROL Statements
The below are the mostly used datasets and its rules to process them.
Input data sets—SORTIN and SORTINnn
Input Datasets are the datasets which contains the data to process with DFSORT.
DFSORT input referred with the name SORTIN.
DFSORT processes two types of input data sets which are individual or group of data sets.
The two types of data sets are
- Input for Sorting or copying (SORTIN data set or SORTIN)
- Input for Merging (SORTINnn data sets or just SORTINnn)
The SORTIN DD statement specifies the input data set.
The SORTINnn DD statements specify the concatenated input data sets.
If a SORTIN DD statement is present it will be used by default for a sort or copy process.
The SORTINnn DD statements specify the data sets for a merge process.
If a SORTINnn DD statement is present, it will be used by default for a merge process.
In SORTINnn, nn can be from 00 to 99. i.e, 100 datasets can be specified in Merge process.
General coding notes:
For copying or sorting process, the SORTIN data set should not be the same as the SORTOUT data set to restrict unpredictable results.
For a sort process, the SORTIN data set should not be the same as any SORTWKnn data set.
FREE=CLOSE cannot be specified.
Note: Merge can process up to 100 data sets with Blockset merge or up to 16 data sets with Conventional merge.
Output data sets—SORTOUT and OUTFIL
Output datasets are the datasets where the DFSORT processed data needs to store.
DFSORT output referred with name SORTOUT if no OUTFIL data sets existed.
If OUTFIL datasets existed, the final output would be OUTFIL datasets only.
DFSORT processes two types of output data sets are
- Output files with no split (referred as the SORTOUT data set)
- Output files with split(OUTFIL data set)
The SORTOUT DD statement specifies the single non-split output data set for a sort, copy, or merges process.
OUTFIL processing does not apply to SORTOUT.
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 a sort, copy, or merge process.
The parameters provided for individual OUTFIL statement defines the OUTFIL processing to be performed for the OUTFIL data sets associated with that DDname.
Each DDname specified must have a corresponding DD statement.
WORK data sets— SORTWKdd
The SORTWKdd datasets used as intermediate storage areas for records to be processed by DFSORT.
Up to 255 SORTWK datasets can be specified for intermediate process.
If Block set technique is not selected and more than 32 specified, only the first 32 are used.
SORTWKdd data sets can be on disk or on tape, but not both. Disk types can be mixed.
In SORTWKdd, dd can be a combination of numeric and alphabets.
One or more SORTWKdd statements are required for each only sorting process (not for merge or copy), unless:
- Input can be contained in main storage.
- Dynamic work space allocation has been requested (DYNALLOC).
In SORWKdd, until the dd is exactly equal SORTWKdd wont treat the DD name as duplicate.
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, you need to use the below DISP parameter.
//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 dataset can be a blocked or unblocked QSAM or VSAM data set if using for Sorting or Copying.
- Input datasets can be up to 100 blocked or unblocked QSAM or VSAM data sets if using for Merging.
- The Datasets can contain fixed- or variable-length records.
- QSAM input data sets 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 input to fixed output, or fixed input to variable output.
- If OUTFIL used, an output data set must be the same type (fixed or variable) as the input data set.
The maximum record length DFSORT can handle based on the type of the files like below:
- Record length should not exceed the maximum record length specified.
- 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 a tape work data set sort, the maximum record length is limited to 32752 bytes with NOEQUALS in effect and to 32748 bytes with EQUALS in effect.