Free-Form Named Constant Definition

A free-form named constant definition begins with DCL-C; followed by the name of the constant; followed by the value either specified directly, or using the CONST keyword; and finally a semicolon.

When a named constant is defined as part of an enumeration, the DCL-C operation code is optional. See Free-Form Enumeration Definition.

Examples of free-form named constant definitions

  • The following example shows two constants named CON_1 and CON_2. One uses the CONST keyword, and the other defines the value of the constant directly. There is no difference in meaning between specifying the CONST keyword and not specifying it.
    
      DCL-C CON_1 CONST(1);
      DCL-C CON_2 2;
    
  • The following example shows a named constant array_total_size that is defined with the value of a built-in function.
    
      DCL-S array CHAR(25) DIM(100);
      DCL-C array_total_size
               %SIZE(array:*ALL);
    

For more examples of free-form named constant definitions, see Example of Defining Literals.