The term program exits refers to the various points in the sort program’s executable code at which control can be passed to a user-written routine. Most exit routines take control once for every record being processed, increasing overall execution time and consuming main storage that would otherwise be used by the sort. Exits should only be coded for tasks which cannot be accomplished with MFX control statements.
Program exits are not allowed to take their own OS or VS checkpoints.
Program exits are labeled with a 2-digit decimal number, e.g., E35. Except for E61, the first digit (1, 2 or 3) refers to the sort/merge phase at which the routine will get control; an E61 routine can take control in Phase 1 or Phase 3. The second digit refers to the number of that exit within the phase. Whenever possible, control passes directly from Phase 1 to Phase 3, skipping the intermediate merge phase and its associated exits: E21, E25 and E27.
As indicated in the following chart, the nature of the task determines the program exit to be used.
PHASE 1 |
PHASE 2 |
PHASE 3 |
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TASK |
E11 | E14 | E15 | E16 | E17 | E18 | E61 | E21 | E25 | E27 | E31 | E32 | E15 * | E35 | E37 | E38 | E39 | E61 |
Prepare for other exit routines | X | X | X | |||||||||||||||
Create input records for sort (Phase 1) and copy (Phase 3) | X | X | ||||||||||||||||
Create input records for merge | X | |||||||||||||||||
Add records | X | X | X | |||||||||||||||
Delete records | X | X | X | X | X | |||||||||||||
Change records | X | X | X | X | X | |||||||||||||
Sum records | X | X | X | |||||||||||||||
Choose action if intermediate storage insufficient |
X | |||||||||||||||||
Close other exit data sets | X | X | X | |||||||||||||||
Process read errors | X | X | ||||||||||||||||
Process write errors | X | |||||||||||||||||
Check labels | X | X | X | |||||||||||||||
Modify a collating sequence | X | X | ||||||||||||||||
* E15 in Phase 3 for copy only |