CONSTANT
|
Where
name is a 1-character to 32-character name conforming to the rules for STL variable names. (See Using variables and constants for more information about variable naming rules.)
integer_constant_expression is an integer constant or an expression involving only integer constants.
string_constant_expression is a string constant or an expression involving only string constants.
Function
The CONSTANT statement declares a named integer or string constant to the STL Translator. Once declared, the translator substitutes the value of the specified constant expression whenever it encounters name in the program.
Examples
constant a 1 /* "A" is a named constant with an */
/* integer value of 1. */
constant x a+5 /* "X" is a named constant with an */
/* integer value of 6. */
constant s 'Hello' /* "S" is a named constant with a */
/* string value of 'Hello'. */
constant t 'there' /* "T" is a named constant with a */
/* string value of 'there'. */
constant y s' 't /* "Y" is a named constant with a */
/* string value of 'Hello there'. */
⋮
b = a /* Equivalent to: b = 1. */
b = 5*x /* Equivalent to: b = 30. */
c = s /* Equivalent to: c = 'Hello'. */
c = s t /* Equivalent to: c = 'Hello' 'there'. */
c = y /* Equivalent to: c = 'Hello there'. */
Notes
- Use named constants instead of string or integer variables whenever possible because they do not require counters, save areas, or switches.
- The CONSTANT statement is a declarative statement. You can code it only outside an STL procedure.