Customizing job processing on a Windows workstation - jobmanrc.cmd
A standard configuration script template
named
TWS_home\config\jobmanrc.cmd is supplied with IBM Workload Scheduler. It is installed automatically as
TWS_home\jobmanrc.cmd. You can use this command file to set the
required environment before each job is run. To alter the file, make your modifications in the
working copy (TWS_home\jobmanrc.cmd), leaving the template file
unchanged. The file contains variables which can be configured, and comments to help you
understand the methodology. Table 1 describes the
jobmanrc.cmd variables. | Variable Name | Value |
|---|---|
| HOME | The path to the TWS_home directory |
| POSIXHOME | The path to the TWS_home directory in a POSIX complaint format |
| LOCAL_RC_OK |
|
| MAIL_ON_ABEND |
|
Running multiple Windows commands in a single job
By default, if you define a job to run two or more Windows commands or .CMD
files separated by the ampersand (&) character, only the first command
runs and subsequent commands are ignored.
To run a chain of commands (for example,
cmd1.cmd & cmd2.cmd), you must modify the jobmanrc.cmd
file as follows:- Modify the jobmanrc.cmd scriptUpdate the following functions in your
jobmanrc.cmdfile:- Update the
:getargsfunction:Ensure the function is defined exactly as shown below::getargs set ARGS=%* - Update the
:launch_argsfunction:Modify the logic to handle the command chain and include theno_local_rclogic for string parsing::launch_args REM Launch job based on ARGS (JCL) if /I "%LOCAL_RC_EXISTS%"=="YES" (goto :yes_local_rc) else (goto :no_local_rc) :yes_local_rc "%USERPROFILE%\jobmanrc.cmd" goto :continue :no_local_rc set doublequote=%ARGS:~0,1% set TEST=%doublequote:"=X% if "%TEST%" == "X " (goto :remove_and_launch) else (goto :launch) :launch call %ARGS% goto :continue :remove_and_launch call %ARGS:~1,-1% goto :continue :continueNote: Ensure there are two spaces after the X in the lineif "%TEST%" == "X ".
- Update the
- Update the Job Definition
To prevent
jobmanrc.cmdfrom interpreting the ampersand (&) as a script separator during its own internal logic, you must wrap the command in an additional set of double quotes within the job definition. The script logic added in Step 1 (call %ARGS:~1,-1%) automatically removes these extra quotes just before the command starts.
Example: Updating a composer definition
Change a standard
definition:
WIN-V91#CHAIN
DOCOMMAND "dir & echo hi"
STREAMLOGON mdm91
DESCRIPTION "Added via composer."
TASKTYPE WINDOWS
RECOVERY STOPTo the modified version with escaped double
quotes:WIN-V91#CHAIN
DOCOMMAND "\"dir & echo hi\""
STREAMLOGON mdm91
DESCRIPTION "Added via composer."
TASKTYPE WINDOWS
RECOVERY STOP