TS/MP Management Programming Manual (G06.24+, H06.03+)

Management Programming Examples
NonStop TS/MP Management Programming Manual540082-001
15-34
Adding or Altering a Server
== Load the buffer (spi^buf). First, set the server name then load it
== into the buffer using #SSPUTV. Then set the server attributes and load
== them into the buffer.
#SET zpwy^ddl^sel^sc:zname:zserverclass [svr^name]
SINK [#SSPUTV spi^buf zpwy^map^sel^sc zpwy^ddl^sel^sc]
[#IF [#MATCH [command^] ADD] |THEN|
#SET zpwy^ddl^def^sc:zcpuinfo:zcpupaircount 1
#SET zpwy^ddl^def^sc:zcpuinfo:zcpupair:zprimary 6
#SET zpwy^ddl^def^sc:zcpuinfo:zcpupair:zbackup 7
#SET zpwy^ddl^def^sc:zmaxservers 2
#SET zpwy^ddl^def^sc:zmaxlinks 2
#SET zpwy^ddl^def^sc:znumstatic 1
#SET zpwy^ddl^def^sc:zprogram [#defaults].object
#SET zpwy^ddl^def^sc:zdefaultvolume [#defaults]
|ELSE|
== alter a couple of values
#SET zpwy^ddl^def^sc:zmaxservers 10
#SET zpwy^ddl^def^sc:zpriority 135
] == end if [match [command^] add] .....
SINK [#SSPUTV spi^buf zpwy^map^def^sc zpwy^ddl^def^sc]
== To communicate with the PATHMON environment, use #REQUESTER to open the
== Pathway environment. Use #APPENDV to send the request in the SPI
== buffer to the PATHMON environment. Use #EXTRACTV to copy the reply from
== Pathway back into the SPI buffer. Finally, terminate the open request to
== Pathway with #REQUESTER CLOSE.
#SET read^err [#REQUESTER/ WAIT [zpwy^val^buflen]/READ &
[pmon^name].#ZSPI io^err reply request]
[#IF read^err |THEN|
#OUTPUT
#OUTPUT **** Error [read^err] opening Pathmon [pmon^name] ****
[#IF not [#EMPTYV io^err] |THEN|
#OUTPUT Error [io^err] is the culprit...
] == end if not [emptyv io^err] ...
|ELSE|
#APPENDV request spi^buf == send the request
#EXTRACTV reply spi^buf == receive the reply
SINK [#REQUESTER CLOSE request]
== Now display the results. Use #SSGETV to extract tokens from the SPI
== buffer. In this case, the ZPWY^DDL^SEL^SC token is extracted using
== ZPWY^MAP^SEL^SC to interpret the token values returned. Finally, use
== #OUTPUTV to display the contents of ZPWY^DDL^SEL^SC. If Pathway
== returns an error via the ZSPI^TKN^RETCODE token, it is captured in the
== result^3 variable.
#SETMANY result^1 result^2 result^3, [#SSGET/ INDEX 1 /spi^buf
zspi^tkn^retcode]
Example 15-2. Adding or Altering a Server (page 4 of 5)