A reserved word is a character-string with a predefined meaning in a COBOL source
unit. Reserved words are listed in Reserved words.
There are six types of reserved words:
- Keywords
- Optional words
- Figurative constants
- Special character words
- Special object identifiers
- Special registers
- Keywords
- Keywords are reserved words that are required within a given clause, entry, or
statement. Within each format, such words appear in uppercase on the main path.
- Optional words
- Optional words are reserved words that can be included in the format of a clause,
entry, or statement in order to improve readability. They have no effect on the execution
of the program.
- Figurative constants
- See Figurative constants.
- Special character words
- There are two types of special character words, which are recognized as special characters only when
represented in single-byte characters:
- Special object identifiers
- COBOL provides two special object
identifiers, SELF and SUPER:
- SELF
- A special object identifier that you can use in the procedure division of a method.
SELF refers to the object instance used to invoke the currently executing method. You can
specify SELF only in places that are explicitly listed in the syntax diagrams.
- SUPER
- A special object identifier that you can use in the procedure division of a method
only as the object identifier in an INVOKE statement. When used in this way, SUPER refers
to the object instance used to invoke the currently executing method. The resolution of
the method to be invoked ignores any methods declared in the class definition of the
currently executing method and methods defined in any class derived from that class.
Thus, the method invoked is inherited from an ancestor class.
- Special registers
- See Special registers.