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

SPI Programming in TACL
SPI Programming Manual427506-006
8-31
Example: Printing or Displaying the Status Structure
of the Subsystem Control Point (SCP)
Example 8-1. Printing or Displaying the Status Structure of the SCP
(page 1 of 2)
?TACL MACRO == SCPSTAT <scpname>
== Display SCP’s status structure.
#FRAME
#PUSH zspi_subvol == ZSPI definitions subvolume
#PUSH err == Error return value
#PUSH retcode == Return code from server
#PUSH io_err == I/O error return value
#PUSH request == Request I/O variable
#PUSH reply == Reply I/O variable
== Locate and load the SPI definition files.
#SET zspi_subvol [#FILENAMES/MAXIMUM 1/ $*.ZSPIDEF.ZSCPTACL]
#SET zspi_subvol [#FILEINFO/VOLUME/[zspi_subvol]].ZSPIDEF
#LOAD/LOADED err/ [zspi_subvol].ZSPITACL
#LOAD/LOADED err/ [zspi_subvol].ZCOMTACL
#LOAD/LOADED err/ [zspi_subvol].ZSCPTACL
== Define the message buffer.
#DEF spi_buf STRUCT LIKE ZCOM^DDL^MSG^BUFFER;
== Assign SCP’s subsystem ID.
#SET ZSCP^VAL^SSID [ZSPI^VAL^TANDEM].[ZSPI^SSN^ZSCP].&
[ZSCP^VAL^VERSION]
== Initialize the buffer for a STATUS command on
== the SCP subsystem PROCESS object type.
#SET err [#SSINIT spi_buf [ZSCP^VAL^SSID] ZCOM^CMD^STATUS
/OBJECT ZCOM^OBJ^PROCESS/]
[#IF err |THEN| *** ERROR [err] from #SSINIT]
== Add the object-name token to the message. The value
== of the token is the name of the SCP process.
#SET err [#SSPUT spi_buf ZCOM^TKN^OBJNAME [_longest %1%] %1%]
[#IF err |THEN| *** ERROR [err] from #SSPUT ZCOM^TKN^OBJNAME]
== Open the SCP process for SPI communications.
#SET err [#REQUESTER /WAIT [ZCOM^VAL^BUFLEN]/
READ %1%.#ZSPI io_err reply request]
[#IF err |THEN| *** ERROR [err] opening %1%.#ZSPI]
== Send the command and await the response.
#APPENDV request spi_buf
#EXTRACTV reply spi_buf
[#IF NOT [#EMPTYV io_err] |THEN|&
*** ERROR [io_err] sending to %1%.#ZSPI]
== Close the SCP process.
#SET err [#REQUESTER CLOSE request]
[#IF err |THEN| *** ERROR [err] closing %1%.#ZSPI]