DSM Template Services Manual

Template-Related DDL Clauses
DSM Template Services Manual427187-004
A-2
TYPE ENUM Clause
This example shows an ENUM DDL DEF:
As this example shows, you need to declare a new token type if you want the
EMSTEXT or the SPI_BUFFER_FORMAT procedures to retrieve the text specified in a
DEFINITION statement of TYPE ENUM. In this example, the EMSTEXT or
SPI_BUFFER_FORMAT procedures read the TOKEN-CODE statement and then look
for the corresponding TOKEN-TYPE statement. Because a token type is declared, the
procedure finds the token type specified in this DDL definition file. This token type has
a DEF of LEGS-DDL-DOMAIN-STATE, which points to the enumeration.
However, if the TOKEN-CODE statement specifies ZSPI-TYP-ENUM directly as the
token type, the EMSTEXT or SPI_BUFFER_FORMAT procedures look at the SPI
token type. The SPI TOKEN-TYPE statement does not have the DEF associating the
token type with an enumeration. Thus, the procedure cannot retrieve the text
associated with the enumeration.
! DDL source code
DEFINITION legs-ddl-domain-state TYPE ENUM TACL ENUM BEGIN.
89 ds-ok VALUE 0 AS
"OK".
89 ds-not-ready VALUE 9 AS "NOT READY".
89 ds-aborted VALUE 11 AS
"ABORTED".
89 ds-recv-pending VALUE 13 AS
"RECEIVE PENDING".
END.
TOKEN-TYPE legs-typ-domain-state VALUE IS zspi-tdt-enum
DEF IS legs-ddl-domain-state.
TOKEN-CODE legs-tkn-domain-state VALUE legs-tnm-domain-state
TOKEN-TYPE legs-typ-domain-state
SSID legs-ssid.