Using SELECT commands in a script

An IBM Spectrum Protect™ script is one or more commands that are stored as an object in the database. You can define a script that contains one or more SELECT commands.

About this task

A script can be run from an administrative client or the server console. You can also include it in an administrative command schedule to run automatically. See Server scripts for details.

IBM Spectrum Protect is shipped with a file that contains a number of sample scripts. The file, scripts.smp, is in the server directory. To create and store the scripts as objects in your server's database, issue the DSMSERV RUNFILE command during installation:
> dsmserv runfile scripts.smp
You can also run the file as a macro from an administrative command line client:
macro scripts.smp

The sample scripts file contains commands. These commands first delete any scripts with the same names as those to be defined, then define the scripts. The majority of the samples create SELECT commands, but others do such things as back up storage pools. You can also copy and change the sample scripts file to create your own scripts.

Here are a few examples from the sample scripts file:
def script q_inactive_days '/* --------------------------------------------*/'
upd script q_inactive_days '/* Script Name:  Q_INACTIVE                    */'
upd script q_inactive_days '/* Description: Display nodes that have not    */'
upd script q_inactive_days '/*    accessed the backup server for a         */'
upd script q_inactive_days '/*    specified number of days                 */'
upd script q_inactive_days '/* Parameter 1: days                           */'
upd script q_inactive_days '/* Example:     run q_inactive_days 5          */'
upd script q_inactive_days '/* --------------------------------------------*/'
upd script q_inactive_days "select node_name,lastacc_time from nodes where -" 
upd script q_inactive_days " cast((current_timestamp-lastacc_time)days as -"  
upd script q_inactive_days " decimal) >= $1 "
/* Display messages in the activity log of severity X or Y                */
 
def script q_msg_sev desc='Show msgs in the activity log of severity X or Y'
upd script q_msg_sev '/* ------------------------------------------------*/'
upd script q_msg_sev '/* Script Name:  Q_MSG_SEV                         */'
upd script q_msg_sev '/* Description: Display messages in the            */'
upd script q_msg_sev '/*              activity log that have either      */'
upd script q_msg_sev '/*              of two specified severities.       */'
upd script q_msg_sev '/* Parameter 1: severity 1                         */'
upd script q_msg_sev '/* Parameter 2: severity 2                         */'
upd script q_msg_sev '/*  where severity is I, W, E, S, or D             */'
upd script q_msg_sev '/* Example:  run q_msg_sev S E                     */'
upd script q_msg_sev '/* ------------------------------------------------*/'
upd script q_msg_sev "select date_time,msgno,message from actlog -"
upd script q_msg_sev "  where severity=upper('$1') or severity=upper('$2')"