Named Constants
Data Definition Language (DDL) Reference Manual — 426798-002
4 -5
CONSTANT Statement
C Guidelines
The following points are guidelines for generating C source code from CONSTANT
statements:
•
If you request C source-code output, by giving the C command, DDL generates
#define
s for named constants.
•
DDL converts any hyphen in the constant name to an underscore (_) in the
#define
name.
•
DDL generates uppercase letters for names that follow #define.
•
For a string constant, DDL generates a
#define
of this form:
#define CONSTANT-NAME string-literal
•
For a numeric constant, DDL generates a
#define
of this form:
#define CONSTANT-NAME numeric-constant
•
For a version constant, DDL generates a
#define
that contains the version
number.
COBOL85 Guidelines
The following points are guidelines for generating COBOL85 source code from
CONSTANT statements:
•
If you request COBOL85 source-code output, by giving the COBOL command,
DDL generates a level 01 data description entry for each named constant.
•
For a string constant, DDL generates a string value identical to the specified
constant value.
•
For a numeric constant, DDL generates a COBOL85 data type based on the type
of the numeric constant:
Unsigned binary constants are translated to COBOL85 signed data types.
•
For a version constant, DDL generates a COBOL85 NATIVE-2 elementary item
that contains the version number.
Constant Type
COBOL85 Data Type
BINARY 16
NATIVE-2
BINARY 32
NATIVE-4
BINARY 64
NATIVE-8
BINARY 16 UNSIGNED
NATIVE-2
BINARY 32 UNSIGNED
NATIVE-4