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

General SPI Programming Guidelines
SPI Programming Manual427506-006
5-12
Sending the Command
After you have allocated the buffer, use the SPI procedures to initialize it and add
tokens containing the information for your command, as described in Section 3, The
SPI Procedures.
Sending the Command
After it has established communication with the management process, your application
can use any standard mechanism for sending and receiving messages. A TAL
program generally uses the file-system procedure WRITEREAD, and can use
AWAITIO (if desired) to perform timed or nowait I/O. A COBOL program normally uses
the standard verb READ WITH PROMPT. A TACL program generally uses the
#APPENDV and #EXTRACTV built-in functions. A C program uses the
tal interface
declaration or alternate-model I/O. The language-specific sections of this manual give
more information about using these languages to send and receive messages encoded
as SPI buffers.
The language features just mentioned are recommended for most applications. In
some specialized applications, however, it might instead be desirable to use a disk-
based buffering scheme or other means. This manual does not go into detail about
such alternative ways to send and receive messages, which apply only to
communication with subsystems not written by HP.
When sending an SPI message to another process, you need to send only the used
portion of the buffer. Your application can obtain the length of the used portion using
the ZSPI-TKN-USEDLEN special SSGET operation. For details, see Section 3, The
SPI Procedures.
Receiving the Response
When your application receives a response message, it must first check for file errors
and reset the buffer. These actions ensure that your command was accepted and that
a valid response was returned. Otherwise, your application might attempt to extract
invalid information.
The first step is to check for file-system errors. The second step is to reset the buffer;
among other things, this operation ensures that your buffer was long enough to contain
the response. The third step is to check for errors in the response buffer.
Checking for File-System Errors
Your application should first check for the usual file-system errors that might occur on
any WRITEREAD call from a requester to a server, plus a few file-system errors that
have special meanings for SPI. These paragraphs provide causes and corrective
actions that apply specifically to programs using SPI.
For information about other file-system errors, see the
Guardian Procedure Errors and
Messages Manual
.