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:
- Select a sequential subset of records with the STARTREC and ENDREC
parameters.
- Select a sample of records with the SAMPLE parameter.
- Select a subset of records with the INCLUDE and OMIT parameters.
These parameters have all of the capabilities of the INCLUDE and
OMIT statements.
- Limit the number of records selected with the ACCEPT
parameter.
- Select "discarded" records with the SAVE parameter. This parameter
saves any records that are not selected as a result of STARTREC, ENDREC,
SAMPLE, INCLUDE, OMIT or ACCEPT parameters.
- Reformat records with fixed position/length fields or variable
position/length fields using the PARSE, BUILD, OUTREC, OVERLAY, or
IFTHEN parameters. These parameters have all of the capabilities of
the PARSE, BUILD, FIELDS, OVERLAY, or IFTHEN parameters on the OUTREC
statement, and also allow you to create multiple output records and
blank output records from each input record.
- Repeat records with the REPEAT parameter.
- Split records between output data sets using the SPLIT, SPLITBY,
and SPLIT1R parameters.
- Create detailed reports with up to three levels (report, page,
and section) using the BUILD, OUTREC, OVERLAY, IFTHEN, HEADERn, TRAILERn,
SECTIONS, LINES, NODETAIL, BLKCCH1, BLKCCH2, BLKCCT1, and REMOVECC
parameters. Your reports can contain elements such as headers, data,
blank lines, trailers, statistics, sections, timestamps, page numbers,
and counts.
- Update count and total values in an existing trailer
(last) record, based on the current data records, with the IFTRAIL
parameter.
- Convert FB records to VB records with the FTOV parameter, or convert
VB records to FB records with the VTOF parameter.
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