Wednesday, January 2, 2019

What happens when you submit a JCL with two JOB statements?

Hello,

In this short article, we'll see what happens when we submit a job with two JOB statements in JCL🤔. Ready?

Let's start with following JCL. 
Image 7.1: JCL with 2 JOB statements

I have defined two JOB statements. The job names are Z31084A and Z31084B. Guess what will happen when I submit this JCL. 

Well, 2 jobs are submitted. See Image 7.2. Hooray!😀 Question answered. But, please spare a minute and read on till the Takeaway section. 

Image 7.2: 2 jobs are submitted. 


Wonder what, both the jobs are failed with JCL error. 

Image 7.3: System message showing that jobs are failed with JCL error. 


But, why the jobs failed? 
Accessing the JESYSMSG (of Z31084A job) in spool shows the following message. 

Image 7.4: Job has no steps. 

JOB HAS NO STEPS. 
So, when you run a job, it MUST contain one or more steps. Otherwise, the job will fail. 

Takeaway: 
The system detects the end of the job when it finds,
  • a // or null statement,
  • another JOB statement,
  • or simply when there are no more records to be read in.
When a JCL with more than one JOB statement is submitted, total no. of jobs submitted will be equivalent to the total no. of JOB statements in the JCL.

When I modify the JCL shown in Image 7.1 by adding a SORT step just below each JOB statement, 2 jobs will be submitted and they would end with RC 00. 

Hope this helps!👍


Screenshot courtesy: Mainframe access 💻 obtained via Master the Mainframe contest run by IBM. 




No comments:

Post a Comment