RUN (Run a Tivoli Storage Manager script)

Use this command to run a Tivoli® Storage Manager script. To issue this command on another server, the script being run must be defined on that server.

You can include RUN commands in scripts as long as they do not create loops. For example, you should avoid including RUN commands where SCRIPT_A runs SCRIPT_B and SCRIPT_B runs SCRIPT_A.

Important: Tivoli Storage Manager does not have a command that can cancel a script after it starts. To stop a script, you must halt the server.

Privilege class

To issue this command, you must have operator, policy, system, storage, or system privilege.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-RUn--script_name--+------------------------+----------------->
                     | .-,------------------. |   
                     | V                    | |   
                     '---substitution_value-+-'   

   .-Preview--=--No------.  .-Verbose--=--No------.   
>--+---------------------+--+---------------------+------------><
   '-Preview--=--+-No--+-'  '-Verbose--=--+-No--+-'   
                 '-Yes-'                  '-Yes-'     

Parameters

script_name (Required)
Specifies the name of the script you want processed. The name you specify cannot be a substitution variable, such as $1.
substitution_value
Specifies one or more values to substitute for variables when the script is run. In a script, a substitution variable consists of a '$' character, followed by a number. When you run the script, Tivoli Storage Manager replaces the substitution variables defined in a script with the values you supply with this command. You must specify values for each substitution variable defined in the script or the script will fail. This parameter is optional.
Preview
Specifies whether to preview the command lines of a script without actually processing the script. The default is NO.
Possible values are:
Yes
Specifies that the command lines included in a script are displayed, but the script is not processed.
No
Specifies that the command lines included in a script are displayed and the script is processed.
Verbose
Specifies whether command lines, variable substitution, and conditional logic testing used in a script are displayed as the script is being processed. This parameter is ignored if PREVIEW=YES is specified. The default is NO.
Possible values are:
Yes
Specifies that the command lines, variable substitution, and conditional logic testing are displayed as the script is being processed.
No
Specifies that the command lines, variable substitution, and conditional logic testing do not display as the script is being processed.

Example: View the commands generated by a script with a table name substitution variable

To run the following example script, called QSAMPLE, you issue a RUN command that specifies the table name ACTLOG as the value for the substitution variable, $1. Use the output to preview the commands generated by the script before running the commands.
001  /* This is a sample SQL Query in wide format */
005  SET SQLDISPLAYMODE WIDE
010  SELECT colname FROM -
015  COLUMNS WHERE TABNAME='$1'
run qsample actlog preview=yes
ANR1461I RUN: Executing command script QSAMPLE.
ANR1466I RUN: Command script QSAMPLE, Line 5 : 
              set sqldisplaymode wide.
ANR1466I RUN: Command script QSAMPLE, Line 15 : 
              select colname from columns where tabname='ACTLOG'.
ANR1470I RUN: Command script QSAMPLE completed successfully 
              (PREVIEW mode)             

Example: Run a script to display and run the commands generated by the script

Run the same script as show in the prior example to display both the generated commands and the results of the commands.
run qsample actlog verbose=yes
ANR1461I RUN: Executing command script QSAMPLE.
ANR1466I RUN: Command script QSAMPLE, Line 5 : 
              set sqldisplaymode wide.
ANR1466I RUN: Command script QSAMPLE, Line 5 : RC=RC_OK
ANR1466I RUN: Command script QSAMPLE, Line 15 : 
              select colname from columns where tabname='ACTLOG'.
 
COLNAME           
------------------
DATE_TIME         
MSGNO             
SEVERITY          
MESSAGE           
ORIGINATOR        
NODENAME          
OWNERNAME         
SCHEDNAME         
DOMAINNAME        
SESSID            
 
ANR1462I RUN: Command script QSAMPLE, Line 15 : RC=RC_OK
ANR1462I RUN: Command script QSAMPLE completed successfully.

Example: Run a script to display just the results of the commands in the script

Run the previous example script, without displaying just the results of the generated commands in the script.
run qsample actlog verbose=no
COLNAME           
------------------
DATE_TIME         
MSGNO             
SEVERITY          
MESSAGE           
ORIGINATOR        
NODENAME
OWNERNAME      
SCHEDNAME     
DOMAINNAME      
SESSID            

ANR1462I RUN: Command script QSAMPLE completed successfully.

Related commands

Table 1. Commands related to RUN
Command Description
COPY SCRIPT Creates a copy of a script.
DEFINE SCRIPT Defines a script to the Tivoli Storage Manager server.
DELETE SCRIPT Deletes the script or individual lines from the script.
QUERY SCRIPT Displays information about scripts.
RENAME SCRIPT Renames a script to a new name.
UPDATE SCRIPT Changes or adds lines to a script.