Reserved Words


  • A reserved word is a word that has a predefined meaning and cannot be used as a user-defined name or identifier.
  • These are required for the language's syntax and semantics, specifying how COBOL programs are structured and executed.
  • Reserved words can be -
    • Keywords
    • Optional words
    • Figurative constants
    • Special character words
    • Special registers
Reserved WordDescription
Keywords A keyword is a reserved word that has a predefined meaning and purpose in the language. They are essential elements in defining data, setting up conditions, controlling the flow of execution, and more.

For example -
ACCEPT
ADD
ALPHABET
ALPHABETIC
ALPHANUMERIC
ASCENDING
ASSIGN
AUTHOR 
...
Optional words Optional words are reserved words that do not affect the program's execution.
They can be included in a sentence or statement to improve readability.

For example -
SKIP1
SKIP2
SKIP3
ROUNDED
...
Figurative constants A figurative constant is a symbolic representation used to indicate specific constant values without specifying the actual value explicitly. They provide a shorter way to represent common values or patterns.

For example -
ZERO, ZEROS, ZEROES
SPACE, SPACES
HIGH-VALUE, HIGH-VALUES
LOW-VALUE, LOW-VALUES
QUOTE, QUOTES
NULL, NULLS
...
Special character words Special character words are used for a special purpose.
There are five types of special character words -

  • Arithmetic operators: + - / * **

    For example -
    COMPUTE WS-SUM = WS-A + WS-B.
    COMPUTE WS-SUB = WS-A - WS-B. 
    COMPUTE WS-DIV = WS-A / WS-B.
    COMPUTE WS-MUL = WS-A * WS-B. 
    COMPUTE WS-EXP = WS-A ** WS-B. 
  • Relational operators: < > = <= >=

    For example -
    IF WS-A < WS-B 
    IF WS-A > WS-B
    IF WS-A = WS-B
    IF WS-A <= WS-B
    IF WS-A >= WS-B 
  • Floating comment indicators: *>
  • Pseudo-text delimiters in COPY and REPLACE statements: ==

    For example -
    COPY COPYBOOK REPLACING ==:WS:== BY ==WS1==.
  • Compiler directive indicators: >>
Special registers Special registers represent storage areas generated by the compiler.
Their primary use is to store information produced by specific COBOL components.

For example -
ADDRESS OF
LENGTH OF
WHEN-COMPILED
...