Job Control Language Basics
Part Two - Challenge #03

Background:


All operating systems execute programs and enable program access to resources such as data on disk.


z/OS uses Job Control Language, (JCL), to:

  • execute programs
  • enable program access to z/OS controlled input and output resources

JCL is a stream of statements where:

  • // in column 1 and 2 identifies statement as JCL
  • JOB statement gives a "name" to the task
  • EXEC statement identifies the program to execute
  • DD statement describes the program input and output resources

JOB, EXEC, and DD relationship -

  • JOB statement is followed by 1 or more EXEC statements
  • EXEC statement is followed by 1 or more DD statements
  • DD statement is associated with the preceding EXEC statement

z/OS environment has "readers" to process JCL statements

  • A submit command is available for readers to process JCL
  • The submit command begins a background task, aka "batch job"
  • Submitted JCL requires a JOB statement
  • A start command is available for readers to process JCL
  • The start command begins a foreground task, aka "started task"
  • Started JCL does NOT use a JOB statement
  • Started JCL task is identified by an assigned procedure name

During the contest, challenges will only submit JCL, not start any JCL.


Challenge

Submit JCL, review JCL job output, identify and correct a JCL error.

From ISPF command line, enter
tso submit jcl(jobs)


View JCL job output using another panel interface - (SDSF) - System Display and Search Facility

From ISPF command line, enter
=sd

From SDSF command line, enter
prefix

From SDSF command line, enter
owner z99999
where z99999 must be replaced with your ID

From SDSF command line, enter
st

The following "SDSF STATUS DISPLAY ALL CLASSES" panel is displayed as a result of the above commands

Note: JOB1, JOB2, and JOB3 may or may not be listed in order in the output queue.

Tab to the NP column and type s to the left of JOB1, JOB2, JOB3 to select the output of each JOB, then press enter. F3 to proceed to next selected job.

Below JOB1 JCL JOB output listing includes ENDED - RC = 0000
RC = 0000, is Return Code 0000, indicating JOB success.

Below JOB2 output also reads ENDED - RC = 0000
  Observe JOB2 has 2 STEPNAMEs (STEP1 and STEP2)
    - A STEPNAME is associated with each EXEC statement following a JOB statement
  Observe JOB1 has 1 STEPNAME (STEP1)
  Reason: JOB2 executed 2 programs (EXEC PGM=) and JOB 1 executed only 1 program.

Below JOB3 output includes JOB NOT RUN - JCL ERROR

JOB3 output has details about the JCL ERROR
STMT NO. MESSAGE indicates y and s are unidentifiable characters on the DD statement
  The output includes a number to the left of each JCL statement
  Observe MESSAGE was about STMT NO. 9

JCL needs to be UPPERCASE
The only exception involves Unix services lowercase named resources that are within quote marks. Fix the JOB3 JCL error to complete the challenge.

How? - Use the ISPF Editor to correct the JCL error

  1. =3.4 - jump to ISPF data set list panel
  2. List your data sets by entering your ID in the Dsname Level field
  3. Edit e your ID JCL data set
  4. Select s member JOBS
  5. Hint: While in edit, enter hilite jcl on the primary command line
  6. Identify and correct JCL error
  7. Enter submit on edit primary command line to have system process corrected JCL
  8. =sd ; st - jump to SDSF panel and status st job output

Repeat the above process until successful execution of JOB3

Duplicate JOBNAMEs are listed as a result of submitting the JCL JOB stream repeatedly
Typically, the highest JobID number is the latest

Unwanted JOBNAMEs can be purged by entering p to the left of the unwanted JCL JOB

Challenge #3 is complete once JOB3 successfully completes.
Successful completion of JOB3 will write #03 member into P2.OUTPUT.

Useful and Optional Information

Like ISPF, SDSF has a help tutorial, (F1)

The "SDSF STATUS DISPLAY" "NP" column
NP is abbreviation for non-protected which means commands can be entered in the NP column

NP column commands:
? - Display a list of the data sets for a job
S - Browse the data sets for a job. You can add:
   B - Use ISPF Browse
   E - Use ISPF Edit
   J - Use ISPF Edit to edit the JCL
P - Cancel a job and purge its output

Next: Challenge #04