Named Constants
Data Definition Language (DDL) Reference Manual — 426798-002
4 -3
CONSTANT Statement
TYPE Clause Guidelines
Each type of numeric constant has a different range of valid values, as
Table 4-1
shows.
The type of a numeric constant performs two functions:
•
It ensures that the specified value is consistent with the type, whether the type is
explicitly specified or is BINARY 16 by default. For example, the value 40,000 is
not consistent with type BINARY 16 because the value is too large, but it is
consistent with type BINARY 16 UNSIGNED. If a value is not consistent with its
type, the CONSTANT statement fails.
•
It controls the types of COBOL, pTAL, and TAL data items generated for the
constant. For example, type BINARY 32 causes DDL to generate a pTAL or TAL
LITERAL with a double-word value and a COBOL NATIVE-4 two-word value. DDL
translates binary numbers as TACL TEXT values rather than as binary data in a
STRUCT so, the TYPE clause does not affect TACL output from DDL constants.
Version Constant Guidelines
The following points are guidelines for specifying version constants:
•
You can use a version constant only in the VERSION clause of a TOKEN-MAP
statement, in the VALUE clause of a DEFINITION statement, or in the VALUE
clause of a CONSTANT statement.
°
When a VALUE clause in a DEFINITION or CONSTANT statement includes a
version constant, DDL treats the version constant as a BINARY 16 integer
type.
°
When a VERSION clause in a TOKEN-MAP statement includes a version
number, the SPI version compatibility mechanism uses the version number to
identify the structure of a particular version of an extensible structured token.
•
When generating output from a version constant for host-language source code,
DDL converts the version string from the form ann to the numeric representation of
a version number returned by the TOSVERSION Guardian procedure.
Table 4-1. Values for Different Types of Numeric Constants
Numeric Type
Valid Values
BINARY 16
-32,768 to 32,767
BINARY 16 UNSIGNED
0 to 65,535
BINARY 32
-2,147,483,648 to 2,147,483,647
BINARY 32 UNSIGNED
0 to 4,294,967,295
BINARY 64
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807