Coding DFSORT procedure statements

If you want to use DFSORT statements in a procedure, then the first line in the procedure must contain the string *FASTPROC coded in column one. You must then code your DFSORT statements in the subsequent lines, prior to any REXX statements. DFSORT statements are coded in columns 1-71.

Z Data Tools supports only the following DFSORT statements:

No other DFSORT statements are supported, except that DFSORT format comment statements can be interspersed with the DFSORT statements. These statements have an asterisk (*) in column 1; they are ignored by Z Data Tools and are not listed in any output.

You can use the DFSORT INCLUDE and OMIT statements to conditionally select records, INREC and OUTREC statements to reformat data, and OUTFIL statements to write to data sets in addition to the primary output data set. This eliminates the need for REXX processing in many basic scenarios.

The DFSORT statements and the output from DFSORT are only displayed if an error is detected. However, if a listing of the DFSORT control statements and output are especially required, the following Z Data Tools control statement can be used in a batch job:
This must be placed as the first Z Data Tools control statement. The output is written to the SYSPRINT data set.

For general information about writing DFSORT statements and for the details of DFSORT statement syntax, see the DFSORT Application Programming Guide.

Pay particular attention to the following points:

DFSORT labels
DFSORT syntax allows a statement label to be coded in column one. This means that operation keywords (such as INCLUDE) must not begin before column two.
DFSORT keywords
DFSORT keywords must be coded in upper case.
Statement continuation
Statements ending with a comma or semicolon are concatenated with the next statement at the first non-blank character.

Statements with a non-blank character in column 72 are concatenated with the next statement. All blanks up to and including column 71 are included in the concatenated statement.

Note: These continuation rules are specific to Z Data Tools, and are a little different from the standard DFSORT statement continuation rules. If you are using DFSORT statements coded for use with the DFSORT product, you might need to modify them to use them in a Z Data Tools procedure.
Specifying data positions in variable-length records
Data positions in DFSORT control statements that refer to variable-length records must allow four extra bytes for the record descriptor word (RDW) preceding the data. For example, the following INCLUDE statement for a fixed-length record:



for a variable-length record.

When Z Data Tools uses DFSORT to process records, all VSAM data sets, except for fixed-length relative record data sets (RRDS's), are treated as variable-length. Non-VSAM data sets are treated as fixed or variable-length, according to the data set specifications.

Using OUTFIL statements
When using OUTFIL statements to write multiple output files, direct one of them to the same file as the Z Data Tools output so any data not needed for the OUTFIL data sets is discarded (see Copying data for an example).

The following examples demonstrate some simple DFSORT statements.

Example 1
To include all records where columns 1-4 contain the name FRED.
Example 2
To process only those records where columns 1-80 are not all blank.
                                                                  col 72
 OMIT COND=(1,80,CH,EQ,C'                                              X