DFSORT input/user exit/output logic examples
Figure 1 gives examples of the logic flow for sort, copy, and merge applications as it relates to SORTINnn, E15 or E35 user exits, and SORTOUT. The intent is to show how your E15 and E35 user exits fit into the logic of an application. All possible paths are not covered. For simplicity, it is assumed that all of the applicable data sets and exits are present and that records are not inserted or deleted. (For a merge, similar logic would be used if an E32 user exit supplied the records rather than SORTINnn data sets.)
Figure 1 illustrates
the following logic:
- E15 and E35 user exits continue to be entered until they pass back a return code of 8. If your user exit passes a return code of 8 to DFSORT when input records still remain to be processed, the records are processed by DFSORT without being passed to your exit.
- During a sort, each record is read from SORTIN and passed to E15 user exit. When all of the records have been processed in this manner, they are sorted by DFSORT, then each sorted record is passed to E35 and written to the output data sets.
- During a copy, each record is read from SORTIN, passed to E15 and E35 user exits, and written to the output data sets.
- During a merge, one record is initially read from each SORTINnn
data set. The record to be output is chosen, passed to E35, and written
to the output data sets. The chosen record is then replaced by reading
a record from the same SORTINnn data set and the process continues. Note: For a merge application, records deleted during an E35 user exit routine are not sequence-checked. If you use an E35 user exit routine without an output data set, sequence checking is not performed at the time the records are passed to the E35 user exit; therefore, you must ensure that input records are in correct sequence.
Functions | Sort Input Phase | Sort Output Phase |
---|---|---|
Open/Initialize | E11, E15 user exits | E31 user exit |
Modify control fields | E61 user exit | N/A |
Insert, Delete/Alter | E15 user exit | E35 user exit |
Sum records | E35 user exit1 | |
Handle special I/O conditions: QSAM/BSAM and VSAM SORTIN |
E18 user exit |
|
Determine action when intermediate storage is insufficient | E16 user exit4 | N/A |
Close/housekeeping | E15, E17 user exits | E35, E37 user exits |
Terminate DFSORT | E15 user exit | E35 user exit |
Note:
|
Functions | Copy | Merge |
---|---|---|
Open/Initialize | E15, E31 user exits | E31 user exit |
Modify control fields | N/A | E61 user exit |
Insert | E15, E35 user exits | E32, E35 user exits |
Delete/alter | E15, E35 user exits | E35 user exit |
Sum records | E35 user exit | E35 user exit1 |
Handle special I/O conditions: QSAM/BSAM and VSAM SORTIN(nn) |
E38 user exit |
E38 user exit |
Close/housekeeping | E35, E37 user exits | E35, E37 user exits |
Terminate DFSORT | E15, E35 user exits | E32, E35 user exits |
Note:
|