Execution Flow of steps in a Job



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Execution Flow of steps in a Job

Postby michelmadhan » Thu Apr 07, 2011 10:01 pm

I have 10 steps in a Job.If one step is bypassed then what about the remaining steps, these are executed or not.
For example 4th step is bypassed by writting the true condition on that step. Then what about the execution of the
remaining steps, they are executed or not.
If you take another example this time the 4th step in the job is abended. Then what about the execution of the
remaining steps, they are executed or not.
I want to know about the execution flow of the above two situations.
michelmadhan
 
Posts: 5
Joined: Wed Mar 30, 2011 1:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Execution Flow of steps in a Job

Postby MrSpock » Thu Apr 07, 2011 10:17 pm

Job steps execute, in order, from top to bottom. What happens in one step does not matter to any other step, other than the instance of a JCL error causing the entire job to be flushed. Now, if you use COND= or IF/THEN/ELSE statements to control the flow of the job steps, then yes, it does matter according to the rules as YOU wrote them.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Execution Flow of steps in a Job

Postby steve-myers » Fri Apr 08, 2011 12:36 am

MrSpock wrote:Job steps execute, in order, from top to bottom. What happens in one step does not matter to any other step, other than the instance of a JCL error causing the entire job to be flushed. Now, if you use COND= or IF/THEN/ELSE statements to control the flow of the job steps, then yes, it does matter according to the rules as YOU wrote them.

Not necessarily. Consider this -
//S01     EXEC PGM=RETCODE,PARM=0
//S02     EXEC PGM=RETCODE,PARM=0
//S03     EXEC PGM=RETCODE,PARM=4
//         IF  RC = 0 THEN
//S04     EXEC PGM=RETCODE,PARM=0
//ADD      DD  DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,1)
//        ELSE
//S04     EXEC PGM=RETCODE,PARM=0
//       ENDIF
//S05     EXEC PGM=RETCODE,PARM=0
//ADD      DD  DISP=(OLD,PASS),DSN=*.S04.ADD
//S06     EXEC PGM=RETCODE,PARM=0
//S07     EXEC PGM=RETCODE,PARM=0
//S08     EXEC PGM=RETCODE,PARM=0
//S09     EXEC PGM=RETCODE,PARM=0
//S10     EXEC PGM=RETCODE,PARM=0

The RETCODE program translates the PARM data to binary and returns with the value as its return code. In other words, it's just a fancy version of the IEFBR14 utility program

There are two versions of step S04. One version executes and creates a dataset. The second version executes but does not create a dataset. Step S05 uses the dataset created by the first version of step S04. This job skips the first version of step S04 because the highest return code for the job was not 0, so the dataset is not created, so step S05 cannot execute, and it causes the job to fail.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Execution Flow of steps in a Job

Postby NicC » Fri Apr 08, 2011 10:33 am

But that is just bad design of the procedure. It is the same as coding a logic error in a program. Rubbish gives rubbish. If S05 was dependent on the dataset from S04 (the first one and I am not sure if you are allowed 2 steps with the same name even if they are in different sections of IF-THEN-ELSE) then S05 should have been coded within the THEN
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Execution Flow of steps in a Job

Postby Anuj Dhawan » Tue Apr 12, 2011 10:41 pm

michelmadhan wrote:I have 10 steps in a Job.If one step is bypassed then what about the remaining steps, these are executed or not.
For example 4th step is bypassed by writting the true condition on that step. Then what about the execution of the
remaining steps, they are executed or not.
If you take another example this time the 4th step in the job is abended. Then what about the execution of the
remaining steps, they are executed or not.
I want to know about the execution flow of the above two situations.
By "true-condition", if you mean that the RC=0 for this step then subsequent job will get executed UNLESS you've coded some COND or IF/THEN/ELSE on them (which you've mentioned actually and I''l take the benefit of doubt).

In second case, when a Job abends, system will check for the COND=ONLY, if coded on some step, yes - execute that, otherwise Job will be just flushed out of the queue.
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Execution Flow of steps in a Job

Postby Anuj Dhawan » Tue Apr 12, 2011 10:58 pm

And I too agree with MrSpcok and NicC!
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Execution Flow of steps in a Job

Postby Akatsukami » Tue Apr 12, 2011 11:21 pm

NicC wrote:I am not sure if you are allowed 2 steps with the same name even if they are in different sections of IF-THEN-ELSE

I tried it and it is permitted. I agree that it's bad design, though.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Execution Flow of steps in a Job

Postby Robert Sample » Tue Apr 12, 2011 11:37 pm

From the JCL Reference manual:
16.1.2 Name Field


A stepname is optional, but is needed for the following. When a stepname is needed, it must be unique within the job, including stepnames in any procedures called by the job. If stepnames are not unique within the job, results might be unpredictable; but in most cases, references to non-unique stepnames will resolve to the first occurrence of that stepname.


Referring to the step in later job control statements.

Overriding parameters on an EXEC statement or DD statement in a cataloged or in-stream procedure step.

Adding DD statements to a cataloged or in-stream procedure step. However, a stepname is not required when adding to the first step in a procedure.

Performing a step or checkpoint restart at or in the step.

Identifying a step in a cataloged or in-stream procedure.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Execution Flow of steps in a Job

Postby Anuj Dhawan » Wed Apr 13, 2011 1:08 pm

Yes, using same name for multple-steps is permitted

 000007 //STEP001  EXEC PGM=SORT                                               
 000008 //SORTIN DD *                                                           
 000009 AAABBB 100                                                             
 000010 CCCDDD 100                                                             
 000011 222555 200                                                             
 000012 //SORTOUT DD SYSOUT=*                                                   
 000013 //SYSIN DD *                                                           
 000014   OPTION COPY                                                           
 000015   INREC FIELDS=(4,3,1,3,7,73)                                           
 000016 //SYSOUT DD SYSOUT=*                                                   
 000017 //*                                                                     
 000018 //STEP001  EXEC PGM=SORT                                               
 000019 //SORTIN DD *                                                           
 000020 AAABBB 100                                                             
 000021 CCCDDD 100                                                             


   Display  Filter  View  Print  Options  Help                                 
 -------------------------------------------------------------------------------
 SDSF JOB DATA SET DISPLAY - JOB QANUJ   (JOB16077)     DATA SET DISPLAYED     
 COMMAND INPUT ===>                                            SCROLL ===> CSR 
 NP   DDNAME   StepName ProcStep DSID Owner    C Dest               Rec-Cnt Page
      JESMSGLG JES2                 2 ANUJ    0 LOCAL                   24     
      JESJCL   JES2                 3 ANUJ    0 LOCAL                   19     
      JESYSMSG JES2                 4 ANUJ    0 LOCAL                   53     
      SORTOUT  STEP001            105 ANUJ    0 LOCAL                    3     
      SYSOUT   STEP001            106 ANUJ    0 LOCAL                   22     
      SORTOUT  STEP001            107 ANUJ    0 LOCAL                    3     
      SYSOUT   STEP001            108 ANUJ    0 LOCAL                   22     
This was a simple case. However, in more practical conditions - I vaguely recall, restart was a nightmare at one of the shops -- and this is one of the points from manuals oo, Robert has pointed to.
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post