jobinfo
Used in a job script to return information about the job. This command is not supported on dynamic agents, pools, dynamic pools, and job types with advanced options.
Syntax
jobinfo -V | -U
jobinfo job-option [...]
Arguments
- -V
- Displays the command version and exits.
- -U
- Displays command usage information and exits.
- job-option
- The job option. Specify one or more of the following:
- confirm_job
- Returns YES if the job requires confirmation.
- is_command
- Returns YES if the job was scheduled or submitted using the docommand construct.
- job_name
- Returns the job's name without the workstation and job stream names.
- job_pri
- Returns the job's priority level.
- programmatic_job
- Returns YES if the job was submitted with using the at or batch command. UNIX only.
- re_job
- Returns YES if the job is being rerun as the result of a conman rerun command, or the rerun recovery option.
- re_type
- Returns the job's recovery option (stop, continue, or rerun).
- rstrt_flag
- Returns YES if the job is being run as the recovery job.
- rstrt_retcode
- If the current job is a recovery job, returns the return code of the parent job.
- schedule
- Returns the name of the job stream where the job is submitted.
- schedule_ia
- Returns the time and date the job stream is scheduled to start.
- schedule_id
- Returns the jobstream_ID of the job stream where the job is submitted.
- time_started
- Returns the time the job started running.
Comments
Job option values are returned, one on each line, in the same order they were requested.
Examples
- The script file /jcl/backup is referenced twice, giving it the job names partback and fullback. If the job runs as partback, it performs a partial backup. If it runs as fullback, it performs a full backup. Within the script, commands like the following are used to make the distinction:
#Determine partial (1) or full (2): if [ "ˋ\ˋmaestro\ˋ/bin/jobinfo job_nameˋ" = "PARTBACK" ] then bkup=1 else bkup=2 fi ...
- To display the return code of the parent job, if the current job is a recovery job, run the following command:
$ jobinfo rstrt_retcode
The first job (parent job) has been defined in the script recovery.sh while the second job (recovery job) gets enabled only if the first job abends.
When combined with a return code condition, jobinfo rstrt_retcode can be used to direct the recovery job to take different actions depending on the parent job's return code. A recovery job is shown in the example below:$JOBS MASTER#DBSELOAD DOCOMMAND "/usr/local/tws/maestro/scripts/populate.sh" STREAMLOGON "^TWSUSER^" DESCRIPTION "populate database manual" RECOVERY RERUN AFTER MASTER#RECOVERY RCCONDSUCC "(RC = 0) OR ((RC > 4) AND (RC < 11))"
Note: The job is defined with the recovery action RERUN. This enables the recovery job to take some corrective action, before the parent job attempts to run again.The recovery job itself is defined as shown in the example below:$ JOBS MASTER#RECOVERY DOCOMMAND "^TWSHOME^/scripts/recovery.sh" STREAMLOGON "^TWSUSER^" DESCRIPTION "populate database recovery manual" RECOVERY STOP