Special Registers

Special registers are reserved words that name storage areas generated by the compiler. Their primary use is to store information produced through specific COBOL features. Each such storage area has a fixed name, and must not be further defined within the program.

In the general formats of this specification, a special register can be used, unless otherwise restricted, wherever a data-name or identifier is specified provided that the special register is the same category as the data-name or identifier. If qualification is allowed, special registers can be qualified as necessary to provide uniqueness.

When control of a program is transferred for the first time from one program to another within the run unit by the CALL statement, the compiler initializes the special register fields to their initial values. The RETURN-CODE and SORT-RETURN special registers are reset to their initial values in the following instances:
  • Whenever the CANCEL statement is invoked to initialize a referenced subprogram
  • For programs that possess the INITIAL attribute
  • For programs that possess the RECURSIVE attribute
In all other cases, the special registers are not reset to their initial values. Instead, they remain unchanged from the value retained the previous time program control was transferred via the CALL statement.

You can specify an alphanumeric register in a function wherever an alphanumeric argument is allowed, unless specifically prohibited.

You can specify a numeric special register in a function wherever a numeric argument is allowed, unless specifically prohibited.

Each special register is discussed in the section beginning on the indicated page.

This register is syntax checked only.

Special Register
Page
DEBUG-ITEM
This register is syntax checked only.
LINAGE-COUNTER
LINAGE-COUNTER Special Register
IBM Extension
End of IBM Extension