In this topic, we described about the Processing with detailed example.
DFSORT processing can be devided into two types based on its processing ways.
- Sorting or Copying
Sorting or copying -
The below diagram shows the detail process of DFSORT processing when using it for sorting or copying.
The below diagram shows the detail process of DFSORT processing when using it for merging.
The below steps provides detail information about how the SORT processes a specific request with all its options and the order of the options processing.
- As a first step DFSORT verifies SORTIN data set provided for SORT or COPY jobs.
Similarly SORTINnn data sets for MERGE jobs.
If SORTIN data exists, DFSORT reads the input records and processes it based on conditions.
If no SORTIN data set is present for SORT or COPY, the records needs to be supplied by cobol user exit( E15 for sorting or copying and E32 for Merging).
- If input records for SORT or COPY are read from a SORTIN data set, DFSORT starts processing specified with the SKIPREC option.
DFSORT starts processing SKIPREC if specified and logically deletes records until the SKIPREC count is satisfied.
- If the input records for SORT or COPY are read from a SORTIN data set, DFSORT checks for specified E15 user exit.
If exists, DFSORT transfers control to the user exit routine.
- DFSORT starts processing INCLUDE or OMIT statement if specified.
- For SORT or COPY, DFSORT starts processing with the STOPAFT option if specified.
- DFSORT starts processing an INREC statement if specified.
- DFSORT starts processing the SORT, MERGE, or OPTION COPY statement specified.
- 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 SUM statement is specified, it will be processed during the SORT or MERGE.
- DFSORT starts processing an OUTREC statement if specified.
- If an E35 user exit is present, DFSORT transfers control to user exit routine after all statement processing (except OUTFIL) is completed.
- DFSORT writes records to the SORTOUT data set at the end, if present.
- DFSORT starts processing one or more OUTFIL statements if specified.
- DFSORT starts processing with the STARTREC, SAMPLE, and ENDREC options if specified.
- DFSORT starts processing with the INCLUDE, OMIT, or SAVE option if specified.
- DFSORT starts processing with the ACCEPT option if specified.
Record processing ends when ACCEPT limit is reached.
- Data records are parsed, edited, reformatted, converted and repeated according to the options specified by using the PARSE, OUTREC, OVERLAY, FINDREP, IFTHEN, FTOV, VTOF (or CONVERT), VLFILL, VLTRIM, VLTRAIL and REPEAT options if specified.
- Data records are reformatted and reports are generated for the OUTFIL data sets by using the LINES, HEADER1, TRAILER1, HEADER2, TRAILER2, SECTIONS, NODETAIL, BLKCCH1, BLKCCH2, BLKCCT1 and REMOVECC options if specified.
- Records are distributed among the OUTFIL data sets as evenly as possible by using SPLIT, SPLITBY, or SPLIT1R processing if specified.
- DFSORT writes OUTFIL records to the appropriate OUTFIL data sets.