Customizing job processing on a Windows workstation - djobmanrc.cmd
About this task
On Windows workstations, you can use the local configuration script djobmanrc.cmd to establish a specific environment when processing your custom jobs. Unlike the jobmanrc.cmd script, you can customize the djobmanrc.cmd script to perform different actions for different users.
The following conditions apply:
- The script must contain all environment application variables or paths necessary for HCL Workload Automation to launch correctly.
- The script must exist if a user-specific environment for running job is required or if an email must be sent to the job logon user when the HCL Workload Automation job ends in error.
To create a custom djobmanrc.cmd script, perform the following
steps:
- Logon as the user who defines environment variables for launching HCL Workload Automation jobs.
- Open a DOS command prompt.
- Type the set command redirecting standard output to a flat file named user_env.
- Create a file named djobmanrc.cmd in the user's Documents
and Settings directory with the following default text at the beginning:
@ECHO OFF echo Invoking %USERNAME% DJOBMANRC.CMD V.1 set USERPROFILE=%USERPROFILE% ::Setup User Environment Phase
- Edit the user_env file created in step 3.
- Insert the set command on each line before each environment variable.
- Add the changes to the PATH variable at the end of the djobmanrc.cmd
in a string similar to the following:
set PATH=<TWSHOME>;<TWSHOME>\bin;%PATH%
- Add the following text at the end of the user_env file
and replace the string user email id with the email ID of the
user that receives the email notification if the job ends in error.
set EMAIL_ID=<user email id> ::Launch Operation Phase %ARGS% ::Post Operations Phase :out
- Add the updated user_env file to the end
of the djobmanrc.cmd file. The edited djobmanrc.cmd file should look
like the following example:
@ECHO OFF echo Invoking %USERNAME% DJOBMANRC.CMD V.1 set USERPROFILE=%USERPROFILE% ::Setup User Environment Phase set ALLUSERSPROFILE=C:\Documents and Settings\All Users set APPDATA=C:\Documents and Settings\petes\Application Data set CommonProgramFiles=C:\Program Files\Common Files set COMPUTERNAME=PSOTOJ set ComSpec=C:\WINDOWS\system32\cmd.exe set CURDRIVE=C set FP_NO_HOST_CHECK=NOset set HOMEDRIVE=c: set HOMEPATH=\docs set LOGONSERVER=\\PSOTOJ set NEWVAR=c:\tmp\tmp\mlist1 set NUMBER_OF_PROCESSORS=1 set OPC_CLIENT_ROOT=C:\opc\Client set OS=Windows_NT set Path=C:\Program Files\utils;C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Utilities;C:\Notes;C:\Program Files\IBM\Trace Facility\;C:\Program Files\IBM\Personal Communications\;C:\Program Files\XLView\;C:\lotus\compnent\;C:\WINDOWS\Downloaded Program Files;C:\Program Files\Symantec\pcAnywhere\;"C:\Program Files\Symantec\Norton Ghost 2003\";C:\Infoprint; set PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH set PCOMM_Root=C:\Program Files\IBM\Personal Communications\ set PDBASE=C:\Program Files\IBM\Infoprint Select set PDHOST= set PD_SOCKET=6874 set PROCESSOR_ARCHITECTURE=x86 set PROCESSOR_IDENTIFIER=x86 Family 6 Model 9 Stepping 5, GenuineIntel set PROCESSOR_LEVEL=6 set PROCESSOR_REVISION=0905 set ProgramFiles=C:\Program Files set PROMPT=$P$G set SESSIONNAME=Console set SystemDrive=C: set SystemRoot=C:\WINDOWS set TEMP=C:\DOCUME˜1\petes\LOCALS˜1\Temp set TMP=C:\DOCUME˜1\petes\LOCALS˜1\Temp set tvdebugflags=0x260 set tvlogsessioncount=5000 set TWS4APPS_JDKHOME=c:\win32app\TWS\pete\methods\_tools set USERDOMAIN=PSOTOJ set USERNAME=petes set USERPROFILE=C:\Documents and Settings\petes set windir=C:\WINDOWSPATH=c:\win32app\tws\twsuser:c:\win32app\tws\twsuser\bin:%PATH% set PATH=c:\win32app\TWS\twsuser;c:\win32app\TWS\twsuser\bin;%PATH% set EMAIL_ID=johndoe@yourcompany.com ::Launch Operation Phase %ARGS% ::Post Operations Phase :out
The Launch Operations Phase in the script is where script, binary or command defined for job is completed. The “%ARGS%” text is required.
The Post Operations Phase in the script is where
a job exit code might be re-adjusted from ABEND to SUCC state, changing
a non-zero exit code to a zero exit code. Some applications might
have exit codes that might be warnings. HCL Workload Automation evaluates
exit codes as either zero or non-zero. Zero exit codes indicate a
job in “SUCC” state. All other codes indicate a job in ABEND state.
Specific non-zero exit codes can be adjusted if necessary. The following
example shows what might be included in the Post Operations Phase.
The example retrieves the exit code of the defined job to determine
how to handle itbased on the If statements:
set EMAIL_ID=johndoe@yourcompany.com
::Launch Operation Phase
%ARGS%
::Post Operations Phase
set RETVAL=%ERRORLEVEL%
if “%RETVAL%”==“0” goto out
if “%RETVAL%”==“1” set RETVAL=0
if “%RETVAL%”==“6” set RETVAL=0
:out
exit %RETVAL%