SPI Programming Manual (G06.24+, H06.03+, J06.03+)

General SPI Programming Guidelines
SPI Programming Manual427506-006
5-18
Defining Simple Tokens
each of which SPI defines as a fixed structure. It is recommended that most structured
tokens defined for a subsystem be extensible structured tokens.
SPI uses a token length of zero in some tokenssuch as the tokens that begin and
end liststo indicate that these tokens have no token values. However, it is
recommended that tokens you define always have a value. If there are only two
choices, the value can be of a Boolean or enumerated type.
Each token you define should have a unique token number. To avoid conflicts with
token numbers defined by software for the NonStop server, always use token numbers
in the range 1 through 9998.
Your subsystem can define its own private token types, using names of the form
subsys-TYP-name and values built from the SPI standard token data types and
appropriate token lengths. For example, an ATM-management subsystem might define
an ATM name as a simple character-string token of a given size, and an ATM location
as a fixed structure containing three character strings identifying the area, city, and
branch. The TOKEN-TYPE statements for these types might resemble:
TOKEN-TYPE ATMX-TYP-ATMNAME VALUE IS ZSPI-TDT-CHAR
DEF IS ATMX-DDL-ATMNAME.
TOKEN-TYPE ATMX-TYP-ATMLOC VALUE IS ZSPI-TDT-STRUCT
DEF IS ATMX-DDL-ATMLOC.
Preceding these TOKEN-TYPE definitions, the subsystem would need to include DDL
DEF statements for ATMX-DDL-ATMNAME and ATMX-DDL-ATMLOC. These could
be similar to:
DEF ATMX-DDL-ATMNAME.
02 Z-C PIC X(8) SPI-NULL " ".
02 Z-S REDEFINES Z-C.
03 Z-I TYPE BINARY 16 OCCURS 4 TIMES.
02 Z-B REDEFINES Z-C PIC X OCCURS 8 TIMES.
END
DEF ATMX-DDL-ATMLOC.
02 X-AREA TYPE ZSPI-DDL-CHAR16.
02 X-CITY TYPE ZSPI-DDL-CHAR16.
02 X-BRANCH TYPE ZSPI-DDL-CHAR16.
END