SPI Tokens
Data Definition Language (DDL) Reference Manual — 426798-002
7- 11
TOKEN-CODE Statement
•
DDL replaces any hyphen in a DDL name with a circumflex (^) in a pTAL or TAL
LITERAL name or in a TACL STRUCT name, and with an underscore (_) in a C
#define name or a Pascal defined constant name.
Standard SPI TOKEN-CODE Definitions. SPI supplies a set of standard token codes
to satisfy needs that are common to most programmatic interfaces. The standard
token-code names have the following format:
Zsss-TKN-name
In this format, the letter Z indicates that the token code is defined by HP, sss is a
subsystem name or a standard SPI name, and name is the token name.
The file ZSPIDEF.ZSPIDDL on the disk volume chosen for your system contains the
DDL definitions of the standard token codes. To use the standard SPI definitions,
compile this file into your dictionary, using the DDL SOURCE command. For a
complete description of the standard SPI token codes, see the SPI Programming
Manual and the SPI Common Extensions Manual.
TOKEN-CODE Statement Examples
The following example shows the DDL statement that defines the token code, ZSPI-
TKN-RETCODE. This token code identifies the standard return token:
TOKEN-CODE zspi-tkn-retcode VALUE IS 0
TOKEN-TYPE IS zspi-typ-enum.
The definition of ZSPI-TKN-RETCODE and the standard token-type definition to which
it refers, ZSPI-TYP-ENUM, are in the file ZSPIDEF.ZSPIDDL.
When writing your own subsystem, you often need to define your own token codes. For
example, you might need tokens to pass status information to and from your
subsystem. The following example shows the TOKEN-CODE statements to define two
such token codes and the TOKEN-TYPE statement to define their token type:
TOKEN-TYPE assn-typ-status VALUE IS zspi-tdt-enum
DEF IS zspi-ddl-enum.
TOKEN-CODE assn-tkn-my-status VALUE IS 101
TOKEN-TYPE IS assn-typ-status.
TOKEN-CODE assn-tkn-stat-reply VALUE IS 102
TOKEN-TYPE IS assn-typ-status.
Notice that the token type is the same in both TOKEN-CODE statements. Any number
of tokens can be of the same token type.
The following examples show the source code DDL generates from the preceding
TOKEN-CODE statements.
Note. When you define a token code specifically for your own subsystem, do not begin its
name with the letter Z; this ensures that your token-code name is not the same as any current
or future name supplied by HP.