COZZI - Check Active Job (CHKACTJOB)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The COZZI - Check Active Job (CHKACTJOB) command quickly searches the system for an active job that matches the job name and optional Job Type and Status parameters. If an active job for the Job Name specified is detected, nothing happens. If it does NOT find a matching job, CPF1070 is sent as an *ESCAPE message. This message may be monitored using the MONMSG command.

Top

Parameters

Keyword Description Choices Notes
JOB Job Qualified job name Required, Positional 1
Qualifier 1: Job Name
Qualifier 2: User Name, *ALL
Qualifier 3: Number 000000-999999, *ALL
STS Job status to check *ACTIVE, *JOBQ, *OUTQ, *ALL, *ANY Optional, Positional 2
TYPE Job Type to check *INTERACT, *INTER, *BATCH, *BCH, *AUTOSTART, *AUTO, *MONITOR, *SPLRD, *SPLWR, *SPLWRT, *SYSJOB, *SYS, *SCPF, *ALL, *ANY Optional, Positional 3
Top

Job (JOB)

Specifies the job name that is used to search for a job whose status and type match the STS and TYPE parameters. This is normally a simple name, such as JOB(USER) rather than a fully qualified name.

This is a required parameter.

Qualifier 1: Job

name
Specify the name of job to be located. A job is considered to be active when it matches the condition of the JOB, STS and TYPE parameters. For example, if STS(*JOBQ) is specified, a job with this name must exist on a job queue or CPF1070 is sent as an escape message. Whereas if STS is unspecified or STS(*ACTIVE) is specified, a job matching this name must be actively running on the system.

Qualifier 2: User

*ALL
Specify a user name or the default of *ALL. It is recommended to use *ALL (all users) to search for a Job whose name matches the Job name portion of this parameter.
name
Specify a user name whose job name needs to match the JOB Name portion of this parameter.

Qualifier 3: Number

*ALL
Specify a job number or the default of *ALL. It is recommended to use *ALL (all job numbers) to search for a Job whose name matches the Job Name portion of this parameter.
000000-999999
If a specific job number is desired, specify it for this parameter.
Top

Job status to check (STS)

Specifies job status of the job name being checked.

*ACTIVE
The job must be an active job.
*JOBQ
The job must be waiting in the JOBQ.
*OUTQ
The job must be completed, and be in the OUTQ status.
*ALL or *ANY
All (or any) job status is used to determine if the job is active.
Top

Job Type to check (TYPE)

Specifies type of job (interactive, Batch, prestart, etc.) to be checked for active status.

*INTERACT or *INTER
The job must be an Interactive job.
*BATCH or *BCH
The job must be a Batch job.
*AUTOSTART or *AUTO
The job must be an Auto-Start job.
*MONITOR
The job must be a subsystem monitor job (rarely used).
*SPLRD
The job must be a SPOOL Reader.
*SPLWR or *SPLWRT
The job must be a SPOOL Writer.
*SYSJOB or *SYS
The job must be a System job.
*SCPF
The job must be the system control program SCPF job.
*ALL or *ANY
Any job Type that matches the Job name specified is checked.
Top

Examples for CHKACTJOB

Example 1: Simple Command Example

CHKACTJOB  JOB(QHTTP)
MONMSG MSGID(CPF1070) EXEC(DO)
   SNDPGMMSG MSG('No HTTP Job found.')
ENDDO

This command checks if the job named QHTTP is active. If it is, the CL program continues. If it is not found, message ID CPF1070 is issued as an *ESCAPE message and the "No HTTP Job found." message is sent to the caller.

Example 2: More Complex Command Example

    CHKACTJOB   JOB(PAYROLL) TYPE(*BATCH)
    MONMSG MSGID(CPF1070) EXEC(DO)
       GOTO CONTINUE
    ENDDO
    SNDPGMSG MSG('Payroll is running. Try again later.')
    RETURN   /* Return to caller. Do not continue. */
CONTINUE: SNDPGMMSG MSG('Payroll not active; continuing...')
ENDPGM

This example checks if the PAYROLL job is running. If it is, the CL program ends. Otherwise it continues.

Top

Error messages for CHKACTJOB

*ESCAPE Messages

CPF1070
Job &3/&2/&1 not found.
Top