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:
+-------------------------------IBM Extension--------------------------------+
+----------------------------End of IBM Extension----------------------------+
The following rules apply to all COBOL words that are not special character words within a source program:
+-------------------------------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.
The types of user-defined words are listed below, with the rules that must
be followed in forming them.
The function of each user-defined word is described in the clause or statement in which it appears.
Related Information:
In general, a user-defined word belongs to one, and only one, of the types listed in the preceding table. A user-defined word must also be unique within the type to which it belongs.
There are two exceptions to the general rule:
For more information about ensuring the uniqueness of reference for such names, see Methods of Data Reference.
The following types of user-defined words can be referenced by statements and entries in that program in which the user-defined word is declared:
The following types of user-defined words can be referenced by any COBOL program:
The following types of names, when they are declared within a Configuration Section, can be referenced by statements and entries either in that program which contains a Configuration Section or in any program contained within that program:
A system-name is a character-string
that is defined by IBM to have a specific meaning to the system. There are four types of system-names:
Computer-name can be written in DBCS characters, but the other system-names cannot.
A function-name is a word that is one of a specified list of words used in COBOL source programs.
A function-name specifies the mechanism provided by ILE COBOL to determine the value of an intrinsic function.
With the exception of the words LENGTH, RANDOM, SUM, and WHEN-COMPILED, a word that is a function-name, in a different context, can appear in a program as a user-defined word, a system-name, or a context-sensitive word.
+-------------------------------IBM Extension--------------------------------+
A context-sensitive word is a COBOL word that is formed according to rules for reserved words, and may be used as specified in the general formats. The same word may also be used as a function-name, a user-defined word, or a system-name.
ILE COBOL context-sensitive words are listed in Appendix D, ILE COBOL Function-Name and Context-Sensitive Word List.
+----------------------------End of IBM Extension----------------------------+
A reserved word is a character-string with a predefined meaning in a COBOL source program, and can be used only as specified in the language defined formats.
ILE COBOL reserved words are listed in Appendix E, ILE COBOL Reserved Word List.
There are five types of reserved words:
Keywords are reserved words that are required within a given clause, entry, or statement.
Optional words are reserved words that may be included in the format of a clause, entry, or statement in order to improve readability. They have no effect on the meaning or execution of the program. Optional words are shown in formats as uppercase, but appear below the main path.
There are two types of special character words:
See Arithmetic Operators.
See Relation Condition.
Figurative constants are reserved words that name and refer to specific constant values. The reserved words for figurative constants and their meanings are:
+-------------------------------IBM Extension--------------------------------+
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
When APOST is specified as a compiler option, the figurative constant QUOTE has the EBCDIC value of an apostrophe.
+----------------------------End of IBM Extension----------------------------+
When a figurative constant other than ALL literal is used, the word ALL is redundant and is used for readability only. The figurative constant ALL literal must not be used with the INSPECT, STOP, or STRING statements.
+-------------------------------IBM Extension--------------------------------+
The literal used in an ALL literal can be a Boolean literal, DBCS literal, or national hexadecimal literal.
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
In the ILE COBOL language, a value of NULL is undefined.
+----------------------------End of IBM Extension----------------------------+
The singular and plural forms of ZERO, SPACE, HIGH-VALUE, LOW-VALUE, QUOTE, and NULL are equivalent, and may be used interchangeably. For example, if DATA-NAME-1 is a 5-character data item, each of the following statements will fill DATA-NAME-1 with five spaces:
MOVE SPACE TO DATA-NAME-1 MOVE SPACES TO DATA-NAME-1 MOVE ALL SPACES TO DATA-NAME-1
A figurative constant can be used wherever 'literal' appears in a format, except where explicitly prohibited. When a numeric literal appears in a format, only the figurative constant ZERO can be used. Figurative constants are not allowed as function arguments except in an arithmetic expression, where they are arguments to a function.
+-------------------------------IBM Extension--------------------------------+
The figurative constant ZERO can be used as a Boolean literal.
+----------------------------End of IBM Extension----------------------------+
The length of a figurative constant depends on the context of the program. The following rules apply:
Special registers are reserved words that name storage areas generated by the compiler. Their primary use is to store information produced through specific COBOL features. Each such storage area has a fixed name, and must not be further defined within the program.
In the general formats of this specification, a special register can be used, unless otherwise restricted, wherever a data-name or identifier is specified provided that the special register is the same category as the data-name or identifier. If qualification is allowed, special registers can be qualified as necessary to provide uniqueness.
When control of a program is transferred for the first time from one program to another within the run unit by the CALL statement, the compiler initializes the special register fields to their initial values. The RETURN-CODE and SORT-RETURN special registers are reset to their initial values in the following instances:
In all other cases, the special registers are not reset to their initial values. Instead, they remain unchanged from the value retained the previous time program control was transferred via the CALL statement.
You can specify an alphanumeric register in a function wherever an alphanumeric argument is allowed, unless specifically prohibited.
You can specify a numeric special register in a function wherever a numeric argument is allowed, unless specifically prohibited.
Each special register is discussed in the section beginning on the indicated page.
The special registers are:
This register is syntax checked only.
+-------------------------------IBM Extension--------------------------------+
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.