HPlogo Using NS 3000/iX Network Services: HP 3000 MPE/iX Computer Systems > Chapter 8 NetCI

Writing and Executing Script Files

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A script file includes all commands, flow control statements, and data that allow you to remotely access and perform operations on nodes. To execute the script file, it must reside on the management node on which NetCI is installed.

Creating a Script File

You can create a script file with any text editor while you are at the MPE colon prompt or from within NetCI. If you are in NetCI, you need to run the editor program from the management node. For example, you enter

     NetCI>K RUN TDP.PUB.SYS

to run the editor on node K which is the management node.

Make sure the editor program resides on the management node, and the user associated with the session is allowed access to the editor. The script file you created will then reside on the management node in the session's user account/group that was specified in NetCI configuration. In this example, the new script file will reside on management node K in the operator.sys account.

Special Symbols

When you create a script file, remember the following:

  • Use the symbol % (percentage sign) preceding an MPE or NetCI command. Subsystem command and program input records should not be preceded by %.

  • Use the symbol ! (exclamation mark) and a parms position number within the script file to indicate the value or string (which is specified with the PLAY command) to be used.

In the PLAY command, the first parameter specified after the file name is considered as position 1. If you specify !1 within your script file, NetCI will substitute the first parms value or string for !1. The file name is considered as position 0.

Reserved Characters

There are also reserved characters that you can use in the script file. Whenever the reserved character is encountered, NetCI substitutes it with specific data as shown in Table 8-1 “Reserved Characters”. NetCI does not refer to the PLAY command for a parms value or string. For example, when the script file contains !a, NetCI substitutes the current account name for !a.

Table 8-1 Reserved Characters

Reserved CharactersSubstituted String
!uCurrent user name
!gCurrent group name
!aCurrent account name
!hHome node
!nCurrent or default node on which execution is occurring
!!Indicates an exclamation mark and not a substitution for a parms value or string

 

Special Slash Character

When a script file is executed on a node or list, the MPE mode is in effect. For example, when you enter

     NetCI>Y PLAY SCRIPT1

you are in MPE mode. MPE assumes only MPE commands are executed in MPE mode. If the script file contains NetCI commands, you must precede these commands with a special slash (/) character in order for the commands to be interpreted as NetCI commands. Refer to SCRIPT1 in the following example on the use of the slash character.

Comment Command

A NetCI COMMENT command is available to allow you to include comments in a script file (containing NetCI commands) that will execute in NetCI mode. Refer to Example 1 for using the NetCI COMMENT command. Since there is an MPE COMMENT command, you can also use this command in a script file (containing MPE commands) that will execute on a node or list. When a script file executes on a node/list, you will be in MPE mode. Refer to Example 2 for using the MPE COMMENT command in a script file executing in MPE mode.

Example 1

This example executes a script file called SCRIPT1 containing NetCI commands. To execute the script file, you enter

     NetCI>PLAY SCRIPT1

Since you are executing SCRIPT1 in the NetCI mode, you are using the NetCI COMMENT in the script file. The SCRIPT1 script file contains the following commands:

%comment show NetCI nodes' %comment and lists' configu- %comment ration

adds comment that this file will list the NetCI configuration for the NET3 network.

%log logfile1

redirects output to log file called LOGFILE1. A slash does not need to precede the NetCI command since you will be in a NetCI mode. Refer to the LOG command discussed later in this section.

%shownode @

displays the NetCI configuration for all nodes.

%showlist @

displays all the lists and the nodes on each list.

%logreset

resets output back to the screen. Refer to the LOGRESET command discussed later in this section.

Example 2

This example executes a script file called SCRIPT2 on node Y, causing you to be in MPE mode. Since there is also an MPE COMMENT command, you do not need to use the NetCI COMMENT command. To execute the script file, you enter

     NetCI>Y PLAY SCRIPT2 FINANCE

The SCRIPT2 script file contains the following commands:

%comment run listdir5 %comment program

adds comment that this file runs the listdir5 program.

%/log logfile2

redirects output to a log file called LOGFILE2. A slash must precede the NetCI LOG command since you will be in MPE mode. Refer to the LOG command discussed later in this section.

%run listdir5.pub.sys

executes program.

listacct !1

lists attributes for the first parms value (which is FINANCE) specified in PLAY command. This is a subsystem command within the program called listdir5.

listgroup @.!1


lists attributes for all groups in FINANCE. This is a subsystem command within listdir5.

listuser @.!1

lists attributes for all users in FINANCE. This is a subsystem command within listdir5.

exit

exits program. This is a subsystem command to exit the listdir5 program.

%/logreset

resets output back to the screen. Refer to the LOGRESET command discussed later in this section.

SCRIPT2 runs a program that lists attributes according to groups and users for an account called FINANCE. We know this information is for the FINANCE account because !1 references the first parms value specified in PLAY. The output will be stored in the log file called LOGFILE2.

Example

This example shows how the slash must precede the NetCI LOG, LOGRESET, LET, WHILE, INC, and ENDWHILE commands since the MPE mode will be established when you execute the script file on a node or list. For example, when you enter

     NetCI>I PLAY SCRIPT3

you will be in MPE mode. A slash must precede each NetCI command as shown in SCRIPT3. The SCRIPT3 script file contains the following:

     %/LOG LOGFILE2
%/LET V=1
%/WHILE V 2
%SHOWJOB
%/INC V
%/ENDWHILE
%/LOGRESET

Special Considerations

There are several considerations that apply to scripting which must be considered since input is redirected from the script file instead of the terminal. These considerations are:

  • Include a password with the logon information during configuration. If you do not include a password, NetCI will automatically assign a password to prevent the system from prompting you for a password.

  • Include the termtype option with the logon information during configuration to prevent a remote application from polling the terminal for termtype during connection establishment. This will occur if the application was part of a logon UDC (such as setting function keys). If you do not include the termtype option, and the remote application requires it, the remote node connection will hang.

Flow Control Statements

Flow control statements may be used in script files to control execution of NetCI commands. Refer to the following pages for more details of the flow control statements.

Feedback to webmaster