MF 

The CONSTANT Clause

The CONSTANT clause specifies that the 01 level item has a constant value, which cannot be modified.

General Format

Syntax for the CONSTANT clause

Syntax Rules

  1. This clause can only be specified at the 01 level.
  2. This clause can only be specified in WORKING-STORAGE and LINKAGE SECTION.
  3. The data item can only be used as sending item in a COBOL statement, and cannot be used in an operand that the statement could modify.
  4. Every elementary item must be subject to a VALUE clause; except, if CONSTANT is specified with a TYPEDEF definition.
  5. This clause cannot be used with the following qualifiers or usage: COMP-1, COMP-2, PIC 1, any pointer type, REDEFINES, EXTERNAL-FORM, index-names, THREAD-LOCAL, or the REENTRANT"2" directive.

General Rules

  1. Data items specifying CONSTANT that will be allocated to WORKING-STORAGE will be placed in read-only memory for native code execution.
  2. CONSTANT items used for EXTERNAL and LINKAGE SECTION means cannot be modified by COBOL statements in the program.
  3. JVM COBOL has its own implementation of a CONSTANT qualifier, which can only be used with Java native types.
  4. The CONSTANT clause on tables is limited to one level of OCCURS.
  5. In table initialization, if a Value clause is used with multiple values (which can initialize individual elements in the table), any other Value clause that follows this one in the code must use multiple values as well or none at all.