Using SPI
Using Programmatic Interfaces
107365 Tandem Computers Incorporated
7–5
TACL interacts with other processes as a server (through $RECEIVE) and as a
requester (through the use of the #REQUESTER, #APPEND(V), and #EXTRACT(V)
built-in functions). When using $RECEIVE, the IN and OUT files do not automatically
provide an SPI interface, but can be made into an SPI interface by using an #INPUTV
and #REPLYV loop protected by an exception handler.
Defining an SPI Buffer
SPI works with binary values. You declare an SPI buffer as a variable of type
STRUCT. TACL allows you to refer to SPI values as text and translates them to and
from binary as necessary.
Each Tandem subsystem includes an SPI definition file, named ZSPIDEF.subsysTACL.
This definition file includes a buffer declaration named subsys^DDL^MSG^BUFFER.
Allocate a buffer variable of at least the size of subsys^VAL^BUFLEN. Some
subsystems use different buffer-size values for different commands; see the individual
subsystem manuals for details. Using these definitions, your STRUCT definition
might look like this:
[#DEF spi_buf STRUCT
BEGIN
BYTE buffer (1:ZTAC^VAL^BUFLEN);
END;
]
When you use the definitions supplied by Tandem, your code retains compatibility
with future changes in length.
TACL sends the length of the STRUCT to the SSINIT procedure and ignores the rest of
the definition.
Note
TACL has a maximum I/O buffer size of 5000 bytes and STRUCT variables are also limited to 5000 bytes.
In addition, TACL cannot perform nowaited I/O to files opened by #REQUESTER for buffers larger than
239 bytes.
Subsystem ID
After you define a buffer, specify a subsystem ID—generally for the target
subsystem—and a command. Include these items in a call to #SSINIT. The following
statement initializes a buffer that contains a status command for the EMS subsystem:
#SET status [#SSINIT spi_buf [ZEMS^VAL^EXTERNAL^SSID]
[ZEMS^CMD^STATUS] ]
The subsystem ID in TACL is specified as one to eight alphanumeric characters or
hyphens that specify the subsystem owner, followed by a period separator, a
subsystem number or a subsystem name, a period, and a version number. All three
information fields are required. You must enter the subsystem owner exactly as
specified for the subsystem; TACL does not case-shift it up or down. The first
character must be alphabetic. TACL supports a special data type, ZSPI^TDT^SSID,
for subsystem ID information.