Launch job task (LJ)

About this task

The LJ task instructs the extended agent method to launch a job on an external system or application. Before running the method, HCL Workload Automation establishes a run environment. The LJuser parameter is read from the method options file to determine the user account with which to run the method. If the parameter is not present or the options file does not exist, the user account specified in the Logon field of the job's definition is used. In addition, the following environment variables are set:

HOME
The login user's home directory.
LOGNAME
The login user's name.
PATH
For UNIX®, it is set to/bin:/usr/bin. For Windows®, it is set to%SYSTEM%\SYSTEM32.
TWS_PROMOTED_JOB
Set to YES, when the job (a mission-critical job or one of its predecessors) is promoted.
TZ
The time zone.

If the method cannot be run, the job is placed in the FAIL state.

Once a method is running, it writes messages to its stdout that indicate the state of the job on the external system. The messages are summarized in Launch job task (LJ) messages.
Table 1. Launch job task (LJ) messages
Task Method Response HCL Workload Automation Action
LJ and MJ %CJ state [mjstring] Sets job state to state. Includes mjstring in any subsequent MJ task.
%JS [cputime] Sets job state to SUCC.
Exit code=non-zero Sets job state to ABEND.
%UT [errormessage] and Exit code=2 Sets job state to ABEND and displays errormessage.

A typical sequence consists of one or more %CJ messages indicating changes to the job state and then a %JS message before the method exits to indicate that the job ended successfully. If the job is unsuccessful, the method must exit without writing the %JS message. A method that does not support the LJ task, writes a %UT message to stdout and exits with an exit code of 2.