Named Constants; Constant Statement - HP DDL D40 Reference Manual

Data definition language
Table of Contents

Advertisement

4

Named Constants

A constant is a DDL dictionary object that has a name, a data type, and a value. You
define a constant in a CONSTANT statement, and you can refer to a constant value by
name in other DDL statements.
This section describes the CONSTANT statement and its components.

CONSTANT Statement

The CONSTANT statement defines a constant and adds it to the currently open DDL
dictionary. Having been added to a dictionary, the named constant can then be used as
a literal value in other DDL statements.
If a CONSTANT statement identifies a constant that is already in the dictionary and
that is not referenced by any other object, DDL replaces the existing constant with the
new constant. If the constant is referenced by another object, DDL issues an error
message and does not add the constant to the dictionary
If a previous compiler command opened a C, COBOL, Pascal, pTAL, TACL, or TAL
source-code file, DDL translates any constant defined in a CONSTANT statement into
the specified language and writes it to the open source-code file.
CONSTANT constant-name
VALUE [ IS ] { { constant-number
[ TYPE type ] .
constant-name
is a DDL name for a constant. For the rules governing DDL names, see
DDL Language
reserved word.
constant-number
is the value of a numeric constant; constant-number can be a signed or
unsigned decimal or octal integer. (To specify an octal integer, preface the number
with a percent sign; for example, %17.)
If the CONSTANT statement includes a TYPE clause, DDL checks the numeric
value to make sure the value is consistent with the specified type.
Data Definition Language (DDL) Reference Manual—426798-002
{ { "string"
{ { national-literal
{ { existing-constant }
{ VERSION "version"
Elements. The name cannot be the same as a DDL keyword or
4 -1
} LN clause }
}
}
}
}
}
}
Section 2,

Advertisement

Table of Contents
loading

Table of Contents