COBOL Words

COBOL words must be character-strings from the set of letters, digits, the hyphen, and the underscore. (The hyphen and the underscore cannot appear as the first or last character, however.) In the ILE COBOL language, each lowercase letter is generally equivalent to the corresponding uppercase letter.

The five types of COBOL words are:
The following rules apply to all COBOL words that are not special character words within a source program:
  • The maximum length of a COBOL word is 30 characters.
  • With the exception of LENGTH, RANDOM, SUM, and WHEN-COMPILED, a reserved word cannot be used as a user-defined word, a system-name, a context-sensitive word, or a function-name.
  • The same COBOL word however, may be used as two or more of the following types of ILE COBOL words:
    • User-defined word
    • System-name
    • Function-name
    • IBM Extension
      IBM Extension Context-sensitive word End of IBM Extension
      End of IBM Extension

    The classification of a specific occurrence of such a COBOL word is determined by the context of the phrase in which it occurs.