JES2 (Job Entry Subsystem 2) is a component of the z/OS operating system that receives jobs into the operating system, schedules them for processing, and manages their output processing. It's responsible for spooling, job queuing, and controlling the entire lifecycle of batch jobs in the mainframe environment.
JES2 commands allow operators and system programmers to monitor and control batch jobs, manage spool resources, and interact with the job processing environment. These commands are essential for day-to-day operations in a mainframe computing environment.
JES2 commands begin with a dollar sign ($) prefix, followed by a verb and potentially additional operands. The basic format is:
1$verb operand,parameter=value
For example, to display job number 123: $D J123
Commands can be entered at the console, through automated facilities, or via the SDSF (System Display and Search Facility) interface.
Command | Description | Example |
---|---|---|
$D J | Display job information | $D J123 - Display info for job 123 |
$C J | Cancel a job | $C J123 - Cancel job 123 |
$H J | Hold a job | $H J123 - Hold job 123 |
$A J | Release a held job | $A J123 - Release job 123 |
$P J | Purge job output | $P J123 - Purge job 123 output |
$T J | Modify job attributes | $T J123,CLASS=A - Change job 123 to class A |
$S J | Start a job | $S J123 - Start job 123 |
$O J | Release job output | $O J123 - Release output for job 123 |
Commands for managing individual jobs:
1234$D J(PAY*) /* Display all jobs starting with PAY */ $D J(*),JOBNAME=PAY* /* Alternative syntax */ $D J(*),STATUS=HELD /* Display all held jobs */ $D J(*),CLASS=A /* Display all class A jobs */
123$C J(*),AGE>1440 /* Cancel jobs older than 1 day (1440 minutes) */ $C J(*),JOBNAME=TEST* /* Cancel all jobs starting with TEST */ $C J(*),C=X,SECLABEL=SECRET /* Cancel class X jobs with security label SECRET */
Commands for managing job initiators, which are the processes that execute batch jobs:
1234567$D I /* Display all initiators */ $D I1-5 /* Display initiators 1 through 5 */ $S I1-3 /* Start initiators 1 through 3 */ $P I4 /* Stop initiator 4 (after current job) */ $Z I5 /* Halt initiator 5 (immediately) */ $T I1,C=A /* Set initiator 1 to process class A jobs */ $T I2,C=(A,B,C) /* Set initiator 2 to process classes A, B, and C */
Commands for managing JES2 spool volumes:
12345$D SPOOL /* Display spool volume status */ $D SPOOLDEF /* Display spool definitions */ $T SPOOL(SPOOL1),HALT /* Halt allocation on SPOOL1 */ $P SPOOL(SPOOL2) /* Drain spool volume SPOOL2 */ $S SPOOL(SPOOL3) /* Start using spool volume SPOOL3 */
Commands for managing job output and printers:
123456789$D O J123 /* Display output for job 123 */ $O J123,ALL /* Release all output for job 123 */ $P O J123 /* Purge output for job 123 */ $D PRT1 /* Display printer 1 status */ $S PRT2 /* Start printer 2 */ $P PRT3 /* Stop printer 3 (after current output) */ $I PRT4 /* Interrupt printer 4 */ $F PRT5,C /* Forward printer 5 to next job */ $B PRT6 /* Backward restart printer 6 */
Commands for controlling the JES2 subsystem itself:
12345678$P JES2 /* Perform orderly shutdown of JES2 */ $S JES2 /* Start JES2 (if it's the primary subsystem) */ $E JES2 /* Restart JES2 after failure */ $D ACTIVATE /* Display activation information */ $ACTIVATE LEVEL=z22 /* Activate z/OS 2.2 JES2 functions */ $D LIMITS /* Display resource limits */ $D MEMBER /* Display JES2 member information (in a multi-access spool configuration) */ $D MASDEF /* Display multi-access spool settings */
JES2 commands support a wide range of modifiers and parameters that allow for precise control:
Parameter | Description | Example |
---|---|---|
JOBNAME or NAME | Job name filter | $D J(*),NAME=PAY* |
CLASS or C | Job class | $D J(*),C=A |
PRIORITY or P | Job priority | $T J123,P=9 |
SYSAFF | System affinity | $T J123,SYSAFF=(SYS1) |
STATUS | Job status filter | $D J(*),STATUS=ACTIVE |
AGE | Job age in minutes | $D J(*),AGE>60 |
OWNER | Job owner (submitter) | $D J(*),OWNER=USER* |
USERID or USERID= | User ID filter | $D J(*),USERID=SYSPROG |
HELD or H | Held status filter | $D J(*),H=YES |
1234567891011/* Step 1: Find all jobs from a specific user */ $D J(*),OWNER=JOHN /* Step 2: Get details about a specific job */ $D J12345,LONG /* Step 3: Cancel the job if necessary */ $C J12345,ARMRESTART /* Step 4: Verify job status after cancel */ $D J12345
The ARMRESTART parameter attempts to invoke automatic restart management for the job if it's defined to ARM.
1234567891011/* Step 1: Check current initiator status */ $D I /* Step 2: Check backlog of jobs by class */ $D JQ,READY,CLASS=A $D JQ,READY,CLASS=B /* Step 3: Modify initiators to balance workload */ $T I1,C=(A,B) /* Add class B to initiator 1 */ $T I2,C=(B,A) /* Rearrange priority for initiator 2 */ $S I3-5 /* Start additional initiators */
1234567891011/* Step 1: Find the job output */ $D O J12345 /* Step 2: Set output priorities and destination */ $T O J12345,OUTDISP=(WRITE,KEEP),PRIORITY=9 /* Step 3: Release output to specific printer */ $O J12345,PRT3 /* Step 4: Verify output was processed */ $D O J12345
1234567891011121314/* Step 1: Display active jobs before shutdown */ $D A /* Step 2: Stop initiators to prevent new jobs from starting */ $P I(*) /* Step 3: Wait for running jobs to complete */ $D A /* Repeat until no jobs are active */ /* Step 4: Shutdown JES2 */ $P JES2 /* Later: Restart JES2 */ $S JES2
Write the JES2 commands to: (1) Display all jobs with names starting with "PAY", (2) Hold all jobs in class P, (3) Change the class of job 1234 to A, and (4) Cancel job 5678 with a dump.
Write the JES2 commands to: (1) Display all initiators, (2) Stop initiators 1 through 3, (3) Modify initiator 4 to process classes A, B, and C, and (4) Start initiators 5 through 8.
Write the JES2 commands to: (1) Display all output for job 1234, (2) Set the output priority to 9, (3) Release the output to printer PRT1, and (4) Verify that the output was processed.
1. Which JES2 command is used to display information about a job?
2. What command would you use to release a held job with ID 1234?
3. Which command is used to cancel a job that is currently executing?
4. What does the "$P JES2" command do?
5. Which command would you use to display all jobs with a name starting with "PAY"?