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

The SPI Procedures
SPI Programming Manual427506-006
3-26
Example: Moving Buffer Tokens Using SSMOVETKN
of change. Programs should never assume that
any
SSMOVE or SSMOVETKN
operation leaves the source buffer unchanged.
After a successful SSMOVE or SSMOVETKN operation, the current-token position
in the source buffer is changed to the position of the last token copied.
When SSMOVE copies a token identified by a token map, the value obtained from
the source buffer is truncated or padded according to the map specifications, and
the ZSPI-TKN-MAX-FIELD-VERSION header token in the destination buffer is
appropriately adjusted.
If an error occurs on SSMOVE or SSMOVETKN, the ZSPI-TKN-LASTERR and
ZSPI-TKN-LASTERRCODE header tokens can be set in either the source buffer or
the destination buffer, depending on whether the error occurred on the logical
SSGET[TKN] or SSPUT[TKN] part of the copy.
SSMOVE or SSMOVETKN can copy an incomplete list (a list with no
corresponding end-list token) if and only if
dest-index is not supplied or is zero.
If a nonzero destination index is specified, meaning that a replacement operation is
being requested, an incomplete list causes SSMOVE or SSMOVETKN to return
ZSPI-ERR-MISTKN.
Example: Moving Buffer Tokens Using SSMOVETKN
The C source code program in Example 3-1 demonstrates the proper use of
SSMOVETKN to move the remaining tokens from one SPI buffer to another buffer.