SPI Tokens
Data Definition Language (DDL) Reference Manual — 426798-002
7 -4
TOKEN-TYPE Statement
OCCURS VARYING [ DEF [ IS ] def-name ]
indicates that the length of the token varies. This clause sets the token length to its
maximum of 255 bytes; only OCCURS VARYING allows structures greater than
254 bytes.
To document the token structure, you can specify a DEF IS clause in the same
statement with an OCCURS VARYING clause. The DEF IS clause does not alter
the host-language output, but it does enable SPI-buffer-display software to
interpret the fields of tokens defined using the token type.
OCCURS 0 TIMES
indicates that the token length is 0
−
effectively there is no token value. A DEF IS
clause cannot be included when OCCURS 0 TIMES is specified.
TOKEN-TYPE Statement Guidelines
The following points are guidelines for using the TOKEN-TYPE statement.
•
Every simple token in an SPI message has a token type to define its data type and
length. You must specify the token type of a simple token in a TOKEN-TYPE
statement.
•
You cannot specify the token type of an extensible structured token because SPI
defines the token type of all extensible structured tokens as the DDL token type
ZSPI-TYP-MAP.
•
The token data type specified in the VALUE clause of the TOKEN-TYPE statement
must be a token data type that has been defined by SPI. If you specify the token
data type as a number, this number must be the value of a predefined token-data-
type constant. The token-data-type constants are defined in the file
ZSPIDEF.ZSPIDDL. As a general rule, you should always refer to one of these
constants for the
token-data-type
value.
•
The length of a simple token is determined by one the following:
°
A definition referenced in a DEF IS clause, optionally repeated by an OCCURS
number
TIMES clause
°
An OCCURS VARYING clause
°
An OCCURS 0 TIMES clause
TOKEN-TYPE Source-Code Output. The following guidelines refer to output
generated by the TOKEN-TYPE statement:
•
If you request C, COBOL, Pascal, pTAL, TACL, or TAL source code, DDL
generates compatible data structures for the requested language. The SPI routines
can use these token-type data structures to identify a token and its type.