try this:

//PROC1      PROC
//PRCSTEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD  DUMMY
//*
//PRCSTEP2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD  DUMMY
//*
//PRCSTEP3 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD  DUMMY
//*
//             PEND
//STEP0001 EXEC PROC1
//PRCSTEP1.SYSIN DD *
 SET MAXCC=0
/*
// IF (STEP0001.PRCSTEP1.RC EQ 0) THEN
//STEP0002 EXEC PROC1
//PRCSTEP2.SYSIN DD *
 SET MAXCC=16
/*
// ENDIF
// IF (STEP0001.PRCSTEP1.RC EQ  0 AND STEP0002.PRCSTEP2.RC EQ 0)
// OR (STEP0001.PRCSTEP1.RC EQ 0 AND STEP0002.PRCSTEP2.RC EQ 16)
//   THEN
//STEP0003 EXEC PROC1,COND=(0,NE,STEP0002.PRCSTEP2)
// ENDIF
//
with step0002 cc = 16
09.51.29 JOB07838  -
--TIMINGS (MI
09.51.29 JOB07838  -STEPNAME PROCSTEP    RC   EXCP   CONN    TCB    SRB
CLOCK
09.51.29 JOB07838  -STEP0001 PRCSTEP1    00     15      2    .00    .00
.0
09.51.29 JOB07838  -STEP0001 PRCSTEP2    00     13      2    .00    .00
.0
09.51.29 JOB07838  -STEP0001 PRCSTEP3    00     13      2    .00    .00
.0
09.51.29 JOB07838  -STEP0002 PRCSTEP1    00     13      2    .00    .00
.0
09.51.29 JOB07838  -STEP0002 PRCSTEP2    16     16      3    .00    .00
.0
09.51.29 JOB07838  -STEP0002 PRCSTEP3    00     16      2    .00    .00
.0
09.51.29 JOB07838  -STEP0003 PRCSTEP1 FLUSH      0      0    .00    .00
.0
09.51.29 JOB07838  -STEP0003 PRCSTEP2 FLUSH      0      0    .00    .00
.0

with step0002 cc =0
 -STEPNAME PROCSTEP    RC   EXCP   CONN    TCB    SRB  CLOCK
 -STEP0001 PRCSTEP1    00     15      2    .00    .00     .0
 -STEP0001 PRCSTEP2    00     13      2    .00    .00     .0
 -STEP0001 PRCSTEP3    00     13      2    .00    .00     .0
 -STEP0002 PRCSTEP1    00     13      2    .00    .00     .0
 -STEP0002 PRCSTEP2    00     15      2    .00    .00     .0
 -STEP0002 PRCSTEP3    00     16      2    .00    .00     .0
 -STEP0003 PRCSTEP1    00     13      2    .00    .00     .0
 -STEP0003 PRCSTEP2    00     13      2    .00    .00     .0

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Scott Barry
Sent: Sunday, June 28, 2009 11:44 AM
To: [email protected]
Subject: Re: Question if COND code / IF THEN struct

On Sun, 28 Jun 2009 01:56:59 -0500, Paul Ip <[email protected]> wrote:

>Hi all,
>
>If I have an JCL with an instream PROC:
>
>PROC1      PROC
>PRCSTEP1 EXEC PGM=XXX
>INPUT       DD DSN=&FILE
>PRCSTEP2 EXEC PGM=YYY
>INPUT       DD DSN=&FILE
>PRCSTEP3 EXEC PGM=ZZZ
>INPUT       DD DSN=&FILE
>              PEND
>STEP0001 EXEC PROC1,FILE=A1
>STEP0002 EXEC PROC1,FILE=A2
>STEP0003 EXEC PROC1,FILE=A3
>...
>STEP000N EXEC PROC1,FILE=AN
>
>PRCSTEP1 will have an RC=0
>PRCSTEP2 will have an RC=16 (but not a failure case)
>PRCSTEP3 will have an RC=0
>
>My question is, how can I code the COND parameter or IF the ELSE on all
>PRCSTEPs so that all the PRCSTEPs can be executed with previous
>PROCSTEPs RC=0 *except* PRCSTEP2 can have a RC=0 to 16.
>I have tried using "RC.PRCSTEP2 = 16" for IF then ELSE before PRCSTEP1
>(since STEP0002.PRCSTEP1 will be executed if RC<=16 of
>STEP0001.PRCSTEP2). However it failed with JCL error since invaild
referback.
>
>Please give me a hint, thanks!
>
>Paul


A slight syntax correction with your post for IF/THEN/ENDIF - when
specifying stepname/procstepname, the ".RC" follows.

More to the point, yes, it would be useful to have the "RUN" condition
not
be so tight that it permits a "not yet declared" stepname/procstepname
exactly for this purpose.

As a circumventive measure, one, less desirable choice, is to resort to
either coding multiple PROC instances with specific check conditions or
use
JCL INCLUDE statements to externalize your individual PROC rqmt
conditions
and enclose the IF/THEN/ENDIF statements as needed for the first and
subsequent PROC executions.

The interpreter is so tight that I was unable to use JCL SET symbolics
with
IF/THEN/ENDIF statements, attempting to set a "blank" SET symbol for the
first execution of the PROC and follow that with another SET overriding
the
initial value to add the additional test after the first execution --
such as:

//         SET RUNCHECK=                                             
//PROC1    PROC                                                      
//   IF    RC = 0 &RUNCHECK THEN                                     
//PRCSTEP1 EXEC PGM=IKJEFT01,PARM=TIME                               
//SYSTSPRT DD   SYSOUT=*                                             
//SYSTSIN  DD   DUMMY                                                
//   ENDIF                                                           
//   IF    RC = 0 &RUNCHECK THEN                                     
//PRCSTEP2 EXEC PGM=IKJEFT01,PARM=BOGUS                              
//SYSTSPRT DD   SYSOUT=*                                             
//SYSTSIN  DD   DUMMY                                                
//   ENDIF                                                           
//   IF    RC = 0 &RUNCHECK THEN                                     
//PRCSTEP3 EXEC PGM=IKJEFT01,PARM=TIME                               
//SYSTSPRT DD   SYSOUT=*                                             
//SYSTSIN  DD   DUMMY                                                
//   ENDIF                                                           
//  PEND                                                             
//STEP0001 EXEC PROC1                                                
//         SET  RUNCHECK='OR (PRCSTEP2.RUN AND PRCSTEP2.RC LT 16)'   
//STEP0002 EXEC PROC1                                                
//STEP0003 EXEC PROC1                                                


Oh well - another strike against JCL coding optimization attempts, while
having somewhat similar angst with "nested PROCs" to some degree, mostly
with restart/recovery attempts.


Scott Barry
SBBWorks, Inc.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to