TS/MP Management Programming Manual (G06.24+, H06.03+)
Management Programming Examples
NonStop TS/MP Management Programming Manual—540082-001
15-32
Adding or Altering a Server
 |1| #SET command^ [command^type]
 #RESULT -1
 |2| #RESULT 0
 #OUTPUT Command type is missing in [#ROUTINENAME]: [#REST]
 #OUTPUT You must specify the type of command to execute;
 #OUTPUT either ADD or ALTER
 |OTHERWISE|
 #RESULT 0
 #OUTPUT Command type is incorrect in [#ROUTINENAME]: [#REST]
 #OUTPUT You must specify the type of command to execute;
 #OUTPUT ADD ALTER
 ] == end case [argument /text command^/ ...
] == end def r_command_ok ... 
== Make sure a server name is supplied and that it is in a valid format. 
== The server name must start with an alphanumeric character and be less 
== than 16 characters in length. (Note: Continuation (for example, ADD 
== SERVER *) is not allowed with the ADD/ALTER commands.)
[#DEF r_format_server_name ROUTINE |BODY|
 #FRAME
 #PUSH check^var == used to ensure server name starts with alpha char.
 #PUSH scname^length == stores length of server name
 #PUSH T^svr^name == server name passed to #argument
 #PUSH ast^ == stores "*"
 #SET ast^ *
 #SET check^var abcdefghijklmnopqrstuvwxyz
 [#CASE [#ARGUMENT /TEXT T^svr^name/ WORD
 OTHERWISE]
 |1| [#CASE [#ARGUMENT END OTHERWISE]
 |1| [#IF [#MATCH [T^svr^name] [ast^]] |THEN|
 #OUTPUT You can only ADD/ALTER one server at a time !!!
 #OUTPUT Please enter a valid server name................
 #RESULT 0
 |ELSE|
 #SET cont^true 0
 [#IF ([#CHARCOUNT T^svr^name] > 15) |THEN|
 #RESULT 0
 #OUTPUT ERROR Server name > 15 characters:[T^svr^name]
 |ELSE|
 == now make sure the server name starts with an
 == alphanumeric character.
 #SET svr^name [T^svr^name]
 #SET scname^length [#CHARCOUNT T^svr^name]
 SINK [#CHARDEL T^svr^name 2 to [scname^length]]
 [#IF [#CHARFIND check^var 1 [T^svr^name]] |THEN|
 #RESULT -1
 |ELSE|
 #RESULT 0
 #OUTPUT Server name invalid: [svr^name]
 ] == end if charfind check^var 1 [t^svr^name] ...
 ] == end if charcount T^svr^name ...
 ] == end if match [T^svr^name] [ast^] ...
 |OTHERWISE|
 #RESULT 0
 #OUTPUT Unexpected argument in [#ROUTINENAME]: [#REST]
 ] == #case [#argument end otherwise]
 |OTHERWISE|
Example 15-2. Adding or Altering a Server (page 2 of 5)










