Named Constants
Data Definition Language (DDL) Reference Manual — 426798-002
4 -8
CONSTANT Statement
CONSTANT Statement Examples
The following examples illustrate CONSTANT statements that define string, numeric,
and version constants:
CONSTANT prog-name VALUE IS "MYPROG".
CONSTANT myprog VALUE IS prog-name.
CONSTANT zspi-val-tandem-owner VALUE IS "TANDEM ".
CONSTANT hundred VALUE IS 100.
CONSTANT double-hundred VALUE 100 TYPE BINARY 32.
CONSTANT quad-num VALUE 800000 TYPE BINARY 64.
CONSTANT zspi-val-msghdrsize VALUE 6 TYPE BINARY 16
UNSIGNED.
The following examples illustrate defining a numeric constant from an existing
constant:
Constant B inherits the type of constant A; that is, constant B is also type BINARY 16
UNSIGNED.
If the second CONSTANT statement includes a TYPE clause, the clause overrides the
defining constant:
The type specified for constant C overrides the type specified for constant A.
When the data types are not the same, the constant value must be compatible with
each specified data type. For example, the following statements are both valid; the
value 1000 is compatible with type BINARY 16 as well as with type BINARY 32:
CONSTANT thousand VALUE 1000 TYPE BINARY 32.
CONSTANT max-value VALUE thousand TYPE BINARY 16.
In the following example, however, the value of HI-VAL is too large for type BINARY
16. DDL issues an error message and does not execute the CONSTANT statement:
CONSTANT fifty-thou VALUE 50000 TYPE BINARY 16 UNSIGNED.
CONSTANT hi-val VALUE fifty-thou TYPE BINARY 16.
*** ERROR *** Invalid value for value type
*** WARNING *** Errors detected - no output produced for HI-VAL
For examples using locale names, see
Appendix B, Sample Schemas
.
CONSTANT a VALUE 200 TYPE BINARY 16 UNSIGNED.
CONSTANT a VALUE b.
Type binary 16 unsigned
VST401.vsd
CONSTANT a VALUE 200 TYPE BINARY 16 UNSIGNED.
CONSTANT c VALUE a TYPE BINARY 16.
Type binary 16
VST402.vsd
Содержание DDL D40
Страница 36: ...Introduction to DDL Data Definition Language DDL Reference Manual 426798 002 1 14 Examining a Dictionary ...
Страница 66: ...Named Constants Data Definition Language DDL Reference Manual 426798 002 4 10 Standard SPI Constants ...
Страница 230: ...Dictionary Manipulation Statements Data Definition Language DDL Reference Manual 426798 002 8 14 SHOW USE OF Statement ...
Страница 370: ...Dictionary Maintenance Data Definition Language DDL Reference Manual 426798 002 10 24 Converting a Dictionary ...
Страница 456: ...Sample Schemas Data Definition Language DDL Reference Manual 426798 002 B 12 ASSNDDL Statements ...
Страница 470: ...DDL Data Translation Data Definition Language DDL Reference Manual 426798 002 C 14 ...
Страница 528: ...Dictionary Reports Data Definition Language DDL Reference Manual 426798 002 E 8 Requesting Reports ...
Страница 552: ...DDL Alignment Rules Data Definition Language DDL Reference Manual 426798 002 H 4 FIELDALIGN_SHARED8 Alignment Rules ...
Страница 576: ...Index Data Definition Language DDL Reference Manual 426798 002 Index 22 Special Characters ...