Reserved words
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 five types of special character words, which
are recognized as special characters only when represented in single-byte
characters:
- Arithmetic operators: + - / * **
- Relational operators: < > = <= >=
- Floating comment indicators: *>
- Pseudo-text delimiters in COPY and
REPLACE statements: ==
See COPY statement and REPLACE statement.
- Compiler directive indicators:
>>
See Compiler directives.
- 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.