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: 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.

The special registers are:

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
ADDRESS OF
ADDRESS OF Special Register
DB-FORMAT-NAME
DB-FORMAT-NAME Special Register
LENGTH OF
LENGTH OF Special Register
LOCALE OF
LOCALE OF Special Register
FORMAT OF
FORMAT OF Special Register
RETURN-CODE
RETURN-CODE Special Register
SORT-RETURN
SORT-RETURN Special Register
WHEN-COMPILED
WHEN-COMPILED Special Register
XML-CODE
XML-CODE Special Register
XML-EVENT
XML-EVENT Special Register
XML-NTEXT
XML-NTEXT Special Register
XML-TEXT
XML-TEXT Special Register
End of IBM Extension