Summary -

In this topic, we described about the Reserved Words with detailed example.

A reserved word is a character-string with a predefined meaning in a COBOL source unit.

Below are the types of reserved words -

  • Keywords
  • Optional words
  • Figurative constants
  • Special character words
  • Special registers
Reserved WordDescription
Keywords Keywords are reserved words that are required within each program coding.
Such keywords appear in uppercase on each sentence, entry, or statement.
Optional words Optional words are reserved words that do not affect the execution of the program.
They can be included in a sentence, entry, or statement format to improve readability.
Figurative constants Figurative constants are reserved words and refer to specific constant values.
Special character words Special character words are used for special purpose.
There are five types of special character words when represented as single-byte characters -
  • Arithmetic operators: + - / * **
  • Relational operators: < > = <= >=
  • Floating comment indicators: *>
  • Pseudo-text delimiters in COPY and REPLACE statements: ==
  • Compiler directive indicators: >>
Special registers Special registers names storage areas generated by the compiler.
Their primary use is to store information produced by specific COBOL features.
Each storage area has a fixed name and should not be required to define within the program.

Example -

Below list shows the examples for each type of Reserved Words -

Type Some Examples
Keywords
ACCEPT
ACCESS
ADD
AFTER
ALL
ALPHABET
ALPHABETIC
ALPHANUMERIC
ASCENDING
ASSIGN
AUTHOR 
...
Optional words
SKIP1
SKIP2
SKIP3
ROUNDED
...
Figurative Constants
ZERO, ZEROS, ZEROES
SPACE, SPACES
HIGH-VALUE, HIGH-VALUES
LOW-VALUE, LOW-VALUES
QUOTE, QUOTES
NULL, NULLS
...
Special character words
Type Some Examples
Arithmetic operators
+ 
- 
/ 
* 
**
Relational operators
< 
> 
= 
<= 
>=
Floating comment indicators
*>
Pseudo-text delimiters in COPY and REPLACE statements
==
Compiler directive indicators
>>
Special registers
ADDRESS OF
DEBUG-ITEM
FORMAT OF
LENGTH OF
LINAGE-COUNTER
RETURN-CODE
SORT-RETURN
WHEN-COMPILED
...