CONTROL Statements


DFSORT control statements can logically divided into two types.

  1. Primary control statements
  2. Secondary control statements

Primary control statements -


The primary control statements are

  1. SORT
  2. MERGE
  3. OPTION

The primary control statements are mandatory for DFSORT. Two primary control statements should not be coded together in DFSORT. Primary control statements can be coded in the combination with secondary control statements. Let’s discuss about primary control lines in detail.

SORT


Specifies the control fields for a sort process, or a copy application. Specifies the fields, fields type and sorting order. Sorting order can be either ascending or descending order.

MERGE


Specifies control fields for a merge process, or a copy application. Specifies the fields, fields type and sorting order. Sorting order can be either ascending or descending order.

OPTION


Overrides installation defaults (EQUALS, CHALT and CHECK) and supplies optional information Specifies for a copy process.

Secondary control statements -


The secondary control statements can be coded along with the primary control statements. The secondary control statements used to reformat the input data.

The secondary control statements can be coded along with primary control statements for additional processing. The below are different types of secondary control statements.

  1. Including or Omitting records
  2. Reformatting and editing records
  3. Producing multiple outputs, reports and converting records
  4. Joining two files
  5. Additional functions and options

Lets discuss about each option in detail.

Including or Omitting records -


This option specifies whether certain records are included in the output datasets or omitted from output datasets.

INCLUDE


INCLUDE option used to specify the criteria and the records which satisfies the criteria will be copied to output.

OMIT


OMIT option used to specify the criteria, the records which satisfies the criteria will be ignored. The remaining records which are not satisfies the criteria will be copied to output.

OUTFIL


OUTFIL option specifies how records are included in the output datasets or omitted from output datasets.

Reformatting and editing records -


This option used to individual records by deleting, reordering fields and inserting blanks, zeroes or constants.

INREC


INREC option specifies how records are reformatted before they are sorted, copied, or merged.

OUTREC


OUTREC option specifies how records are reformatted after they are sorted, copied, or merged.

OUTFIL


OUTFIL option specifies how records are reformatted in multiple output data sets.

Producing multiple outputs, reports and converting records -


This option specifies to produce multiple output data sets and reports, convert variable-length records to fixed-length records and convert fixed-length records to variable-length records.

OUTFIL


OUTFIL option specifies how records are to be converted from variable-length to fixed-length or from fixed-length to variable-length.

Joining two files -


This option specifies to perform various types of "join" operations on two files (F1 and F2) by one or more keys.

JOINKEYS


One JOINKEYS statement is required for each input file to indicate the ddname of the file.

JOIN


An inner join is performed by default, but a JOIN statement can be used to specify a different type of join.

REFORMAT


Describes the fields from the two files to be included in the joined records. Optionally an indicator of where the key was found ('B' for both files, '1' for file1 only or '2' for file2 only).

Additional functions and options -


These are remaining control statements to perform a variety of tasks.

ALTSEQ


ALTSEQ option specifies the changes to the ALTSEQ translation table to be used for SORT, MERGE, INCLUDE or OMIT fields with format AQ. Also for INREC, OUTREC, and OUTFIL fields with TRAN=ALTSEQ, and for INREC, OUTREC, and OUTFIL fields with format AQ in logical expressions.

DEBUG


DEBUG option specifies for various diagnostic options.

END


END option causes DFSORT to discontinue reading SYSIN, SORTCNTL, or DFSPARM.

RECORD


RECORD option can be used to supply length and type information.

SUM


SUM option specifies numeric summary fields of all records with equal control fields are summed in one record and that the other records are deleted.