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 in each sentence, entry, or statement. Such keywords appear in uppercase on each sentence, entry, or statement within each program construction.
Optional words Optional words are reserved words that can be included in a sentence, entry, or statement format to improve readability. They have no effect on the execution of the program.
Figurative constants Figurative constants are reserved words that name and refers to specific constant values.
Special character words 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 name 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 must not be defined again 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
...