HCL Workload Automation, Version 9.4

Customizing job processing for a user on UNIX workstations - .jobmanrc

About this task

On UNIX workstations, the local configuration script .jobmanrc permits users to establish a required environment when processing their own jobs. Unlike the jobmanrc script, the .jobmanrc script can be customized to perform different actions for different users. Each user defined as tws_user can customize in the home directory the .jobmanrc script to perform pre- and post-processing actions. The .jobmanrc script is an extra step that occurs before the job is actually launched.

The .jobmanrc script runs only under the following conditions:
  • The standard configuration script, jobmanrc, is installed, and the environment variable LOCAL_RC_OK is set to yes (see Table 1).
  • If the file TWS_home/localrc.allow exists, the user's name must appear in the file. If the TWS_home/localrc.allow file does not exist, the user's name must not appear in the file, TWS_home/localrc.deny. If neither of these files exists, the user is permitted to use a local configuration script.
  • The local configuration script is installed in the user's home directory (USER_home/.jobmanrc), and it has execute permission.
Jobs are not automatically run, the command or script must be launched from inside the .jobmanrc. Depending on the type of process activity you want to perform, the command or script is launched differently. Follow these general rules when launching scripts from inside .jobmanrc:
  • Use eval if you want to launch a command.
  • Use either eval or exec if you want to launch a script that does not need post processing activities.
  • Use eval if you want to launch a script that requires post processing activities.
If you intend to use a local configuration script, it must, at a minimum, run the job's script file ($UNISON_JCL). HCL Workload Automation provides you with a standard configuration script, jobmanrc, which runs your local configuration script as follows:
$EXECIT $USE_SHELL $USER_home/.jobmanrc "$UNISON_JCL" $IS_COMMAND
where:
  • The value of USE_SHELL is set to the value of the jobmanrc SHELL_TYPE variable (see Table 1).
  • IS_COMMAND is set to yes if the job was scheduled or submitted in production using submit docommand.
  • EXECIT is set to exec if the variable USE_EXEC is set to yes (see Table 1), otherwise it is null.

All the variables exported into jobmanrc are available in the .jobmanrc shell, however, variables that are defined, but not exported, are not available.

The following example shows how to run a job's script file, or command, in your local configuration script:
#!/bin/ksh
PATH=TWS_home:TWS_home/bin:$PATH
export PATH
/bin/sh -c "$UNISON_JCL"
The following is an example of a .jobmanrc that does processing based on the exit code of the user's job:
#!/bin/sh
#
PATH=TWS_home:TWS_home/bin:$PATH
export PATH
/bin/sh -c "$UNISON_JCL"
#or use eval "$UNISON_JCL" and the quotes are required
RETVAL=$?
if [ $RETVAL -eq 1 ]
then
 echo "Exit code 1 - Non Fatal Error"
 exit 0
elif [ $RETVAL -gt 1 -a $RETVAL -lt 100 ]
then
 conman "tellop This is a database error - page the dba"
elif [ $RETVAL -ge 100 ]
then
 conman "tellop Job aborted. Please page the admin"
fi