DSM Template Services Manual

Template Language
DSM Template Services Manual427187-004
3-12
DEF_ENUM Statement
The DEF_ENUM statement is necessary only for shared tokens whose enumerated
values have different names in different applications. (If a token is not shared, its token
type can refer directly to a DDL DEFINITION statement of type ENUM that provides
the enumeration labels, and a DEF_ENUM statement is unnecessary.)
The syntax for the DEF_ENUM statement is:
tkn-or-fld
identifies a shared token or field. The token can have any of these token data
types: (ZSPI-TDT-) ENUM, INT, UINT, BYTE, or BOOLEAN. The token can have
any of these DDL types: ZSPI-DDL-BOOLEAN, LOGICAL 1, or LOGICAL 2.
enum-def
is a DDL DEFINITION statement of type ENUM whose level-89 names are
appropriate for this application and correspond to values of the token or field.
You can use multiple DEF names to partition the range of values into subranges. The
subranges must not overlap. This lets the names of one subrange be the same across
applications, while the names of another subrange are unique to each application.
Example
The template source file in Example 3-5 uses the DEF_ENUM statement to associate
a shared token with enumerations from two different subsystems. The first subsystem,
FEET, is based on SPI. The second subsystem, LEGS, is based on FEET and SPI.
LEGS adds additional subsystem-specific enumeration values to a shared token
defined by FEET. The corresponding DDL definition files for FEET and LEGS are
shown after the template source file, in Example 3-6 and Example 3-7.
As this example shows, you can associate a shared token with an enumeration:
1. Define each enumeration in a DDL definition file, along with any constants used in
the enumeration.
2. Associate one or more enumerations with the name of a shared token by adding a
DEF_ENUM statement to the template source file.
3. Add the appropriate MSG statements to the template source file to construct
operator messages. For tokens associated with the enumeration (through the
DEF_ENUM statement), the token values are translated to text within the operator
message.
The SPI_BUFFER_FORMAT procedures also use the enumerations when constructing
text for token values.
DEF_ENUM: tkn-or-fld AS enum-def [, enum-def ] ...