DFSORT Datasets and Rules

DFSORT DD statements and parameters DFSORT CONTROL Statements

Advertisements


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.

  1. Input for Sorting or Copying.
    These datasets specified with SORTIN DD statement.

  2. 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.


Coding Notes:

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.


Note:

Merge can process up to 100 datasets with Blockset merge or up to 16 datasets with conventional merge.


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.

  1. Single output file with SORTOUT. If no OUTFIL coded, the output dataset can be specified with SORTOUT DD Statement.
  2. Single output file with OUTFIL. This can be acheived by specifying single OUTFIL statement.
  3. 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)

Datasets Rules:

  1. Input datasets can be blocked or unblocked QSAM or VSAM dataset if using for Sorting or Copying.
  2. Input datasets can be up to 100 blocked or unblocked QSAM or VSAM datasets if using for Merging.
  3. The Datasets can contain fixed or variable-length records.
  4. QSAM input datasets can be concatenated even if they are on different devices.
  5. Output dataset can be blocked or unblocked QSAM or VSAM data sets regardless of input dataset type.
  6. OUTFIL can be used to convert variable length input to fixed length output, or fixed length input to variable length output.
  7. 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.

DFSORT DD statements and parameters DFSORT CONTROL Statements

Advertisements