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.
Table 1. Functions of Routines
at Program User Exits (Sort)Functions of Routines at
Program User Exits (Sort)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
QSAM/BSAM SORTOUT
VSAM SORTOUT
|
E18 user exit
E19 user exit2
N/A
|
E38 user exit2
E39 user exit3
E39 user exit3
|
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: - The SUM control statement can be used instead of your
own routine to sum records.
- Applies only to a tape work data set sort.
- E39 can be used for SORTOUT, but not for OUTFIL data
sets.
- Applies only to a tape work data set sort or a Peerage/Vale
sort without work data sets.
|
Table 2. Functions of Routines
at Program User Exits (Copy and Merge) Functions of
Routines at Program User Exits (Copy and Merge)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)
QSAM/BSAM and VSAM SORTOUT
|
E38 user exit
E39 user exit
|
E38 user exit
E39 user exit
|
Close/housekeeping |
E35, E37 user exits |
E35, E37 user exits |
Terminate DFSORT |
E15, E35 user exits |
E32, E35 user exits |
Note: - The SUM control statement can be used instead of your
own routine to sum records.
|