IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to Restart a step within IF condition


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvadlamudi

New User


Joined: 19 Apr 2007
Posts: 68
Location: India

PostPosted: Tue May 10, 2011 7:13 pm
Reply with quote

Hi,

Please let me know, how to restart the below job at step IEB02 which is in the if condition. I dont want to alter the steps by removing the IF condition. Is it possible to restart by changing the job card with restart parameter.

Code:
//USERIDAA   JOB CLASS=X,MSGCLASS=X
//*
//*----------------------------------------------------------------------------
//IEB01      EXEC PGM=IEBGENER
//SYSUT1     DD    *
001
/*
//SYSUT2     DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSIN      DD DUMMY
//*----------------------------------------------------------------------------
//CHK01      IF IEB01.RC=0 THEN
//IEB02      EXEC PGM=IEBGENER
//SYSUT1     DD    *
001
/*
//SYSUT2     DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSIN      DD DUMMY
//           ENDIF
//*----------------------------------------------------------------------------
//CHK02      IF IEB02.RC=0 THEN
//IEB03      EXEC PGM=IEBGENER
//SYSUT1     DD    *
001
/*
//SYSUT2     DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSIN      DD DUMMY
//           ENDIF



---------------------
Thanks
Mouli
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue May 10, 2011 8:15 pm
Reply with quote

You have to remove the IF/ENDIF, or you'll have to change step IEB01 (you could just dummy it out with a PGM=IEFBR14).
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue May 10, 2011 8:35 pm
Reply with quote

How I do it is code the IF statement like this:
Code:

//CHK01      IF ((IEB01.RC=0) OR
//            (IEB01.RUN EQ FALSE)) THEN
//IEB02      EXEC PGM=IEBGENER
//SYSUT1     DD    *
001
/*
//SYSUT2     DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSIN      DD DUMMY
//           ENDIF


I do this any time I think I may want to restart within an IF statement.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed May 11, 2011 1:18 am
Reply with quote

I always code my JCL so that I do not have to restart within an IF statement. You just have to plan your JCL and test it.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed May 11, 2011 11:12 am
Reply with quote

Hi,

Code:
//CHK01      IF ((IEB01.RC=0) OR
//            (IEB01.RUN EQ FALSE)) THEN
//IEB02      EXEC PGM=IEBGENER
//SYSUT1     DD    *
001
/*
//SYSUT2     DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSIN      DD DUMMY
//           ENDIF


So what happens when IEB01 flushes ? IEB02 will run, is that really what you want ?

I prefer Nic's approach.

Gerry
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed May 11, 2011 5:18 pm
Reply with quote

Quote:
So what happens when IEB01 flushes ? IEB02 will run, is that really what you want ?


How exactly is the first step of the job going to 'flush'?

It may run with a bad return code (if will fail then).

If it doesn't run, then yes, that is what he wants in this case.

If by planning your, jcl you accomplish the same result, then we now have two ways of doing this. Works for me.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu May 12, 2011 3:54 am
Reply with quote

Hi daveporcelan,


yes you are right in this particular example.

So what happens when IEB02 flushes, IEB03 will run if the same concept is used
Code:
//CHK01      IF ((IEB02.RC=0) OR
//            (IEB02.RUN EQ FALSE)) THEN


Gerry
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu May 12, 2011 5:20 pm
Reply with quote

Hi gcicchet,

Quote:
So what happens when IEB02 flushes, IEB03 will run if the same concept is used


It depends on the requirement. He may want to do this or may not.

One case in our environment where we do this is:
Code:
//STEP1      PGM=DB2 UNLOAD of 200 Tables
//TEST1      IF ((STEP1.LE=4) OR
//            (STEP1.RUN EQ FALSE)) THEN
//STEP2      PGM=DB2 LOAD of 200 Tables
//ENDTEST1   ENDIF


Sometimes we get a failure during the load process. We correct the issue and restart where we left off.

I am sure there are other ways, but this is our way of planning our jcl to accomplish the requirement. I think it is a good approach.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Forcing a step to run (even if abended) JCL & VSAM 8
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
Search our Forums:

Back to Top