Processing


DFSORT processing is divided into two types based on its processing ways and those are -

  • Sorting or Copying
  • Merging

Sorting or copying -


The detail process of DFSORT processing when using for sorting or copying shown below -

Processing

Merging -


The detail process of DFSORT processing when using for merging shown below -

Processing

Process -


Detailed information about how the SORT processes a specific request with all its options and the order of the options processing is shown below -

  1. DFSORT verifies the SORTIN data set coded for SORT or COPY jobs. Similarly SORTINnn files for MERGE jobs. If SORTIN data exists, DFSORT reads the input records and starts processing. If no SORTIN data set is present, it will throw a JCL error.
  2. If input records are read from a SORTIN data set, DFSORT starts processing the records with the SKIPREC option. DFSORT skips the records logically until the SKIPREC count is satisfied.
  3. DFSORT starts processing INCLUDE or OMIT statement if coded.
  4. DFSORT starts processing with the STOPAFT option if coded.
  5. DFSORT starts processing an INREC statement if coded.
  6. DFSORT starts processing the SORT, MERGE, or OPTION COPY statements coded.
    • For SORT, all input records are processed by default before any output record is processed.
    • For COPY or MERGE, an output record is processed after an input record is processed.
    • For SORT or MERGE, if a SUM statement is specified, it will be processed during the SORT or MERGE.
  7. DFSORT starts processing an OUTREC statement if coded.
  8. DFSORT writes records to the SORTOUT data set at the end if coded.
  9. DFSORT starts processing one or more OUTFIL statements shown below if they are coded -
    • DFSORT starts processing with the STARTREC, SAMPLE, and ENDREC options if coded.
    • DFSORT starts processing with the INCLUDE, OMIT, or SAVE option if coded.
    • DFSORT starts processing with the ACCEPT option if coded. Record processing ends when the ACCEPT limit is reached.
    • Data records are parsed, edited, reformatted, converted, and repeated according to the options by using the PARSE, OUTREC, OVERLAY, FINDREP, IFTHEN, FTOV, VTOF (or CONVERT), VLFILL, VLTRIM, VLTRAIL and REPEAT options if coded.
    • Data records are reformatted and reports are generated for the OUTFIL files by using the LINES, HEADER1, TRAILER1, HEADER2, TRAILER2, SECTIONS, NODETAIL, BLKCCH1, BLKCCH2, BLKCCT1, and REMOVECC options if coded.
    • Records are distributed among the OUTFIL files as evenly as possible by using SPLIT, SPLITBY, or SPLIT1R processing if coded.
    • DFSORT writes OUTFIL records to the appropriate OUTFIL files.