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

COND referback in nested PROCS?


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

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu May 15, 2014 6:34 pm
Reply with quote

Hi, I have the following requirement:

My JCL is:
Code:

XPROC1   EXEC PROC=PROC1
COPY01   EXEC PGM=ICEGENER,COND=(0,NE, ????)

Code:

where PROC1 contains two EXEC PROC= statements:
XPROC2   EXEC PROC=PROC2
  contains:
  XTHEPGM2 EXEC PGM=THEPGM2

XPROC3   EXEC PROC=PROC3
  XTHEPGM3 EXEC PGM=THEPGM3


Am I able to code a COND, so that the step COPY01 is only executed if both XTHEPGM2 and XTHEPGM3 returns RC=0?

Thanks,
Claes
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu May 15, 2014 9:22 pm
Reply with quote

Yes.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon May 19, 2014 12:57 pm
Reply with quote

Thanks, but I already read that page, and I couldn't adopt it to my issue, and I only came here after like 40 tries...

Giving my example, are you able to give the correct syntax, please?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Mon May 19, 2014 1:29 pm
Reply with quote

I believe the answer is "NO":
Quote:
5.Modifying or additional JCL statements can only have procstepname.name or procstepname.ddname in their name field. Do not specify backward references to nested procedures, such as procstepname.procstepname.ddname DD parameters.

One of the resons for not using nested procedures.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon May 19, 2014 2:07 pm
Reply with quote

I believe the answer is NO as well.. However, I really wanted it to be YES icon_smile.gif Thanks anyways.

Claes
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 19, 2014 2:58 pm
Reply with quote

Do all the steps in the two procs give zero normally? Ie, would it be OK to not run if any step in those two procs gives non-zero?
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon May 19, 2014 3:10 pm
Reply with quote

Bill, I see what you're getting at icon_smile.gif But the JCL stream I've got is a potentionally long (dynamically generated), and thus it can be a long list of EXEC PROC1 and COPY steps, like this:
Code:

XPROC1A   EXEC PROC=PROC1
COPY01A  EXEC PGM=ICEGENER,COND=(0,NE, ????)
XPROC1B   EXEC PROC=PROC1
COPY01B   EXEC PGM=ICEGENER,COND=(0,NE, ????)
XPROC1C   EXEC PROC=PROC1
COPY01C   EXEC PGM=ICEGENER,COND=(0,NE, ????)


I only wish to execute the COPY step, if the corresponding executing of the PROC step went well.

I am working on a solution to add a step in PROC1 that will test the RC from the two PROC calls with IDCAMS and MAXCC. Any thoughts on that would be great! icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Mon May 19, 2014 6:19 pm
Reply with quote

Include your ICEGENER in PROC1?
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon May 19, 2014 6:35 pm
Reply with quote

That would be a good solution, if only PROC1 weren't used throughout our system. icon_smile.gif What I did is this in PROC1:

Code:

//IF01     IF (STEP1.PROCSTEP.RC = 0 & STEP2.PROCSTEP.RC = 0) THEN
//ELSE01   ELSE                                                       
//CHECK    EXEC PGM=IDCAMS                                           
//IN       DD DUMMY                                                   
//SYSPRINT DD SYSOUT=*                                               
//SYSIN    DD DSN=member,DISP=SHR             
//ENDIF01  ENDIF                                                     

member contains:
PRINT INFILE (IN) COUNT (1)       
IF LASTCC NE 0 THEN SET MAXCC = 13


Then I should be able to test on PROC1.CHECK in the calling job?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon May 19, 2014 6:48 pm
Reply with quote

Quote:
That would be a good solution, if only PROC1 weren't used throughout our system.


So your proposed change to PROC1 is acceptable?

Could an extra step with a rouge return code throw off someone elses COND statement in their Job?

Would it be safer to create a NEW proc PROC1B to do exactly what you want (the ICEGENER step)?
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon May 19, 2014 7:51 pm
Reply with quote

Dave, that may be the end of it - however I'd like to get my solution to work, but it doesn't seem to do so for more than 1 "set" icon_sad.gif I'll explain..

I have my proc, PROC1:
Code:

// PROC1 PROC .....

//STEP1  EXEC PROC2
.....
//STEP2  EXEC PROC3
.....
//IF01     IF (STEP1.PROCSTEP.RC = 0 & STEP2.PROCSTEP.RC = 0) THEN
//ELSE01   ELSE                                                       
//CHECK    EXEC PGM=IDCAMS                                           
//IN       DD DUMMY                                                   
//SYSPRINT DD SYSOUT=*                                               
//SYSIN    DD DSN=member,DISP=SHR             
//ENDIF01  ENDIF                                                     

member contains:
PRINT INFILE (IN) COUNT (1)       
IF LASTCC NE 0 THEN SET MAXCC = 13


Then the calling job is eg.:
Code:

.....
STEPA EXEC PROC1
COPYA EXEC PGM=ICEGENER,COND=(13,EQ,STEPA.CHECK)

STEPB EXEC PROC1
COPYB EXEC PGM=ICEGENER,COND=(13,EQ,STEPB.CHECK)

Meaning that the copy operation should only be performed if CHECK didn't return RC=13. However, the IF condition of PROC1 only works correctly for the first pass (STEPA), then if the CHECK CC of STEPB should be different, it still catches the result from STEPA. Does anyone know if there's a solution to this?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon May 19, 2014 8:24 pm
Reply with quote

Quote:
however I'd like to get my solution to work


Good luck with that. Trying to get a poor solution to work, is not worth it to me.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Reference for COND parameter. JCL & VSAM 1
No new posts IEF142I and Cond. Code 12 All Other Mainframe Topics 3
No new posts Cond parameter and Rc code of a proce... JCL & VSAM 5
No new posts INCLUDE COND with WHEN=GROUP SYNCSORT 12
Search our Forums:

Back to Top