Evaluate schedule return codes in schedule scripts
You can use environment variables to determine the current IBM® Storage Protect return code before you run a script by using either the preschedulecmd or postschedulecmd client options.




IBM Storage Protect provides
the current value of the return code in the environment variable called TSM_PRE_CMD_RC. The TSM_PRE_CMD_RC variable
is the current value of the IBM Storage Protect return
code before you run a schedule script. The value of the TSM_PRE_CMD_RC variable is not necessarily the same as
the return code issued by IBM Storage Protect following
the execution of the schedule script. The TSM_PRE_CMD_RC variable can be used in schedule scripts to determine the current
state of the schedule.
The TSM_PRE_CMD_RC variable is set on each of the following schedule options: preschedule, prenschedule, postschedule, and postnschedule. TSM_PRE_CMD_RC affects those schedules that have the ACTION=COMMAND option specified.
An example of the TSM_PRE_CMD_RC variable in use:





if [[ -n ${TSM_PRE_CMD_RC} ]] ; then
if [[ ${TSM_PRE_CMD_RC} == 0 ]] ; then
echo "The TSM_PRE_CMD_RC is 0"
elif [[ ${TSM_PRE_CMD_RC} == 4 ]] ; then
echo "The TSM_PRE_CMD_RC is 4"
elif [[ ${TSM_PRE_CMD_RC} == 8 ]] ; then
echo "The TSM_PRE_CMD_RC is 8"
elif [[ ${TSM_PRE_CMD_RC} == 12 ]] ; then
echo "The TSM_PRE_CMD_RC is 12"
else
echo "The TSM_PRE_CMD_RC is an unexpected value: ${TSM_PRE_CMD_RC}"
fi
else
echo "The TSM_PRE_CMD_RC is not set"
fi