Using a DFSORT or REXX procedure

You can specify an existing DFSORT or REXX procedure, or create a new one, to further enhance the way in which data is selected and copied.

You can code any number of DFSORT or REXX statements and functions to manipulate the output record, select specific records, print reports and tally numeric values.

When you are coding a REXX procedure, be aware of the following:
  • A copy procedure is run after record-level selection, and any field selection supplied in a template, has been performed.
  • If the record has been reformatted as a result of the template processing, the variable INREC contains the input record value and the variable OUTREC contains the reformatted output record.
  • If a Copy count is specified, this can affect the number of records presented to the REXX procedure. The Copy count only applies to the number of records written to the primary output data set. It does not apply to records written in the REXX procedure with the WRITE() function.
  • When using the PRINT() function with field formatting (TABL or SNGL), the template is determined as follows:
    • If an input template without an output template has been specified, the input template is used.
    • If an output template is specified, and the record value specified to print is the input record, the input template is used. Otherwise the output template is used.
    • If a record cannot be matched against a record layout in the selected printing template, it is not printed.
    Ensure the record value matches the template that File Manager uses to print the data set.

Related topics