Data Definition Language (DDL) Reference Manual

Named Constants
Data Definition Language (DDL) Reference Manual529431-004
4-5
Existing Constants
Existing Constants
When using the name of an existing constant as the value in a CONSTANT statement:
You can specify a DDL constant name instead of a literal value in the VALUE
clause of a CONSTANT statement whether the constant name identifies a string
constant, a numeric constant, or a product version constant.
When the name identifies a previously defined string constant, the new value is
identical to the value of the string constant.
When the name identifies a previously defined product version constant, the new
value is identical to the value of the product version constant.
When an existing numeric constant is named in the definition of another DDL
numeric constant, certain rules apply:
°
If the CONSTANT statement does not include a TYPE clause, the constant
being defined inherits the type of existing-constant.
°
If the CONSTANT statement has a TYPE clause, its specified type overrides
the type of existing-constant.
°
If a TYPE clause in the CONSTANT statement overrides the type of
existing-constant, the value of existing-constant must be
consistent with the specified type.
C
When generating C source code from CONSTANT statements:
If you request C source-code output, by giving the C command, the DDL compiler
generates #defines for named constants.
The DDL compiler converts any hyphen in the constant name to an underscore (_)
in the #define name.
The DDL compiler generates uppercase letters for names that follow #define.
For a string constant, the DDL compiler generates a #define of this form:
#define CONSTANT-NAME string-literal
For a numeric constant, the DDL compiler generates a #define of this form:
#define CONSTANT-NAME numeric-constant
For a product version constant, the DDL compiler generates a #define that
contains the product version number.