Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Restart a step within IF condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to Restart a step within IF condition
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

Moderator Team Head


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

PostPosted: Tue May 10, 2011 8:15 pm    Post subject: Reply to: How to Restart a step within IF condition
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: 662
Location: Pennsylvania

PostPosted: Tue May 10, 2011 8:35 pm    Post subject:
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: 1756
Location: UK

PostPosted: Wed May 11, 2011 1:18 am    Post subject:
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: 1703
Location: Australia

PostPosted: Wed May 11, 2011 11:12 am    Post subject:
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: 662
Location: Pennsylvania

PostPosted: Wed May 11, 2011 5:18 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Thu May 12, 2011 3:54 am    Post subject:
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: 662
Location: Pennsylvania

PostPosted: Thu May 12, 2011 5:20 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us