SORT Statement Registers

IBM DOS/VS COBOL has 11 special registers associated with the SORT statement. ACUCOBOL-GT supports five of these. When in the IBM DOS/VS compatibility mode, ACUCOBOL-GT treats these as dummy registers, as though they had been declared at the beginning of the WORKING-STORAGE section as follows:

01  SORT-MESSAGE PIC X(8) EXTERNAL
77  SORT-FILE-SIZE PICTURE S9(8) USAGE COMP-4 VALUE 0.
77  SORT-CORE-SIZE PICTURE S9(8) USAGE COMP-4 VALUE 0.
77  SORT-MODE-SIZE PICTURE S9(5) USAGE COMP-4 VALUE 0.
77  SORT-RETURN PICTURE    S9(4) USAGE COMP-4 VALUE 0.

Special registers are reserved words that name storage areas, which are generated by the compiler. They do not need to be declared in the Working-Storage section of your program, and they can still be referenced as data items in your program. It's important to understand the data format for which they implicitly are created and to understand that they behave as though they were declared variables. These registers cannot be used as operands of ACCEPT or DISPLAY statements (as in IBM DOS/VS COBOL), but values can be moved to and from them.