How DFSORT-enhanced processing works

File Manager extracts the DFSORT control statements, if any, from the procedure, and invokes DFSORT to perform the required input and output operations. The control statements are passed to DFSORT and processed by that product according to its rules. If template processing is not required, and the procedure does not contain any REXX statements, then the entire operation is performed under the control of DFSORT.

If File Manager needs to get control during the operation, to perform template processing or execute REXX statements contained in the procedure, then it does this via DFSORT's E35 exit. This means that all of the processing for the INCLUDE, OMIT, INREC, and OUTREC statements is performed before File Manager regains control for each record. When File Manager regains control, it first applies the record identification and selection criteria associated with the input template, and the mapping (for the REXX OUTREC variable) associated with the output template, then invokes REXX to process REXX procedure statements, if any, and finally it applies any formatting operations associated with the output template.

When File Manager returns control to DFSORT any OUTFIL control statements found in the procedure are processed. This means that your OUTFIL statements must be coded to take into account not only the effect of any INREC or OUTREC statements coded in the procedure, but also the effect of any template or REXX processing that might also have been performed. Correspondingly, any templates used or REXX statements processed must allow for the effect of any INREC or OUTREC statements coded in the procedure.