You can control several aspects of sort behavior by inserting values in special registers before the sort or by using compiler options. You might also have a choice of control statements and keywords.
You can verify sort behavior by examining the contents of special registers after the sort.
The table below lists those aspects of sort behavior that you can affect by using special registers or compiler options, and the equivalent sort control statement keywords if any are available.
| To set or test | Use this special register or compiler option | Or this control statement (and keyword if applicable) |
|---|---|---|
| Amount of main storage to be reserved | SORT-CORE-SIZE special register | OPTION (keyword RESINV) |
| Amount of main storage to be used | SORT-CORE-SIZE special register | OPTION (keywords MAINSIZE or MAINSIZE=MAX) |
| Modal length of records in a file with variable-length records | SORT-MODE-SIZE special register | SMS=nnnnn |
| Name of sort control statement data set (default IGZSRTCD) | SORT-CONTROL special register | None |
| Name of sort message file (default SYSOUT) | SORT-MESSAGE special register | OPTION (keyword MSGDDN) |
| Number of sort records | SORT-FILE-SIZE special register | OPTION (keyword FILSZ) |
| Sort completion code | SORT-RETURN special register | None |
| Century window for sorting or merging on date fields | YEARWINDOW compiler option | OPTION (keyword Y2PAST) |
| Format of windowed date fields used as sort or merge keys | (Derived from PICTURE, USAGE, and DATE FORMAT clauses) | SORT (keyword FORMAT=Y2x) |
Sort special registers: SORT-CONTROL is an eight-character COBOL special register that contains the ddname of the sort control statement file. If you do not want to use the default ddname IGZSRTCD, assign to SORT-CONTROL the ddname of the data set that contains your sort control statements.
The SORT-CORE-SIZE, SORT-FILE-SIZE, SORT-MESSAGE, and SORT-MODE-SIZE special registers are used in the SORT interface if you assign them nondefault values. At run time, however, any parameters in control statements in the sort control statement data set override corresponding settings in the special registers, and a message to that effect is issued.
You can use the SORT-RETURN special register to determine whether the sort or merge was successful and to stop a sort or merge operation prematurely.
A compiler warning message (W-level) is issued for each sort special register that you set in a program.
related tasks
Determining whether the sort or merge was successful
Stopping a sort or merge operation prematurely
Changing DFSORT defaults with control statements
Allocating space for sort files
DFSORT Application Programming Guide (Using DFSORT program
control statements)
related references
Default characteristics of the IGZSRTCD data set