HP DDL D40 Reference Manual page 64

Data definition language
Table of Contents

Advertisement

Named Constants
CONSTANT Statement Examples
The following examples illustrate CONSTANT statements that define string, numeric,
and version constants:
CONSTANT prog-name
CONSTANT myprog
CONSTANT zspi-val-tandem-owner VALUE IS "TANDEM
CONSTANT hundred
CONSTANT double-hundred
CONSTANT quad-num
CONSTANT zspi-val-msghdrsize
UNSIGNED.
The following examples illustrate defining a numeric constant from an existing
constant:
CONSTANT a VALUE 200 TYPE BINARY 16 UNSIGNED.
CONSTANT a VALUE b.
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:
CONSTANT a VALUE 200 TYPE BINARY 16 UNSIGNED.
CONSTANT c VALUE a TYPE BINARY 16.
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
CONSTANT max-value
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
CONSTANT hi-val
*** ERROR *** Invalid value for value type
*** WARNING *** Errors detected - no output produced for HI-VAL
For examples using locale names, see
Data Definition Language (DDL) Reference Manual—426798-002
VALUE IS "MYPROG".
VALUE IS prog-name.
VALUE IS 100.
VALUE 100
VALUE 800000 TYPE BINARY 64.
VALUE 6
Type binary 16 unsigned
Type binary 16
VALUE 1000
VALUE thousand
VALUE 50000
VALUE fifty-thou
Appendix B, Sample
4 -8
CONSTANT Statement
".
TYPE BINARY 32.
TYPE BINARY 16
VST401.vsd
VST402.vsd
TYPE BINARY 32.
TYPE BINARY 16.
TYPE BINARY 16 UNSIGNED.
TYPE BINARY 16.
Schemas.

Advertisement

Table of Contents
loading

Table of Contents