A COBOL word can be formed using the following characters:0-9
The following rules must be adhered in forming COBOL words.
(i) A word cannot begin or end with a hyphen.
(ii) A word can have at the maximum 30 characters.
(iii) One of the characters must be a letter. Some compilers put the additional
restrictions that the first character must be a letter.
(iv) Except hyphen (-) no special character allowed.
Valid Word Invalid Word & Reason
emp-sal -pay ( it starts with a hyphen)
TOTAL MARK (blank space embedded)
There are 2 types of words in COBOL. A COBOL word can be either a user-defined
word or reserved word. The reserved words are used in COBOL statements and entries for
specific purposes by the COBOL compiler.
Some reserved words are given below:
ADD, SUBTRACT, DIVIDE, MULTIPLY, IF, PERFORM etc.
To know the complete set of reserved words of COBOL one can refer to the manual
supplied with the compiler. Any attempt by the programmer to declare the reserved word
will be indicated as an error during the compilation stage of the program.