Creating multiple output data sets and reports

You can create one or more output data sets and reports from a single pass over sorted, merged, or copied input using OUTFIL control statements. You can use different OUTFIL parameters on different OUTFIL statements, so the output data sets you create in a single DFSORT application can be identical or very different. You can perform a wide variety of tasks with each OUTFIL statement, including the following:

You can use OUTFIL statements with any of the other DFSORT statements (for example, INCLUDE, OMIT, INREC, SORT, MERGE, OPTION, SUM and OUTREC). OUTFIL processing is performed last, after all of the processing for the other statements, as shown in Processing order of control statements. Thus, the output records created by the processing for the other statements are the input records for OUTFIL processing. For example, OUTFIL processes the sorted records if the SORT statement is specified, or the copied records if the OPTION COPY statement is specified.

Combining the various DFSORT statements in different ways gives you a lot of flexibility. You can actually use an INREC statement, an OUTREC statement, and an OUTFIL statement to reformat your input records three times. You can also use an INCLUDE or OMIT statement to keep a subset of the input records, and use OUTFIL statements with different INCLUDE or OMIT and OUTREC, OVERLAY, or IFTHEN parameters to write different subsets of the remaining records into different OUTFIL data sets reformatted in different ways