Restart capability enables SORT to resume processing at the most recent control point following the discontinuation of the program.
Operating SORT in restart mode provides the necessary restarting information for the sort but requires certain program inputs that are defined in the following text. The program must provide logic to restore and maintain stack variables, arrays, files, and pointers that are defined for and by the program. In other words, the program must provide the means to restore everything necessary for it to continue from the point of discontinuation. This capability can be simple or complex and is entirely program-dependent. The program cannot use the CHECKPOINT/RERUN function when a sort is executing.
Restart capability is implemented for disk sorts only; however, a partially restartable ITD sort is also possible. When SORT is not in the tape phase of an ITD sort, it functions as a disk sort. After the data is written from disk to tape during an ITD sort, SORT cannot be restarted.
If SORT is started as a disk-only restartable sort with insufficient disk space provided to accomplish the sort, SORT terminates with SORT ERROR #4 or #5. After error termination, SORT can be restarted as an ITD sort by indicating a RESTART and specifying the number of tapes desired. Any other kind of restart is impossible under this condition.
If a restartable sort terminates during the first output of data from disk to tape (possibly as a result of an irrecoverable tape I/O error), SORT can be restarted and the data is written to tape as if no problem had occurred.
When using SORT in restartable mode, file equation should be used to give unique titles to the control file and the work file. Refer to “SORT Files” for more information about these files. Conflicts might arise when two or more sorts use identical file titles for their sort disk files.
When SORT attempts to restart a previously incomplete sort, sort record size and character size of the sort record characters are verified to ensure that continuation is compatible with the previous sort. For ALGOL programs, record size is explicitly specified by the program while character size is 0 (default size is 8). COBOL programs use the SD to determine sort record and character size. When record size or character size does not match the previous sort, error termination occurs.
Other sort parameters—except number of tapes—can be modified. Different values for memory size or disk size are ignored, and the original values are used. However, both values must be valid nonzero values. Different procedures can be specified (for input, output, or comparing) if desired, files can be substituted for input or output procedures, and input or output procedures can be specified for files. The program requesting the restart need not be the originating program. Because SORT can only attempt to meet your request and cannot determine appropriateness of requests, you must make sure that you get the desired results.