Format 5

Format 5 describes constant-names. Constant-name can only be described as a level-01 entry.

Format 5: constant-name

Read syntax diagramSkip visual syntax diagram 101 constant-name-1CONSTANT ISGLOBAL ASliteral-1LENGTH OFdata-name-2

The CONSTANT clause is used to associate a constant name with a literal. The constant name can then be used in place of a literal. The CONSTANT clause can only be specified for level-01 entries for elementary constant name. The CONSTANT clause can also be defined as another previously defined constant name.

A constant name needs to be defined in a CONSTANT clause before its use. It can be used in DATA DIVISION and PROCEDURE DIVISION where literal or integer is allowed, except in the compiler-directing statements, such as COPY statement and TITLE statement.

constant-name-1 may be used anywhere that a format specifies a literal of the class and category of constant-name-1. The class and category of constant-name-1 is the same as that of literal-1 or is an integer if LENGTH OF phrase is specified. If constant-name-1 is an integer, it may also be used to specify repetition in a picture string.

Literal-1 cannot be a figurative constant.

If the LENGTH OF phrase is specified, the value of constant-name-1 is determined as specified in the LENGTH intrinsic function with the exception that when data-name-2 is a variable-length data item described with the OCCURS DEPENDING ON clause, the maximum size of the data item is used.