MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Condition checking in JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
THRIVIKRAM
Beginner


Joined: 03 Oct 2005
Posts: 70
Topics: 34

PostPosted: Tue Jun 20, 2006 4:59 am    Post subject: Condition checking in JCL Reply with quote

Hello,

I have the following problem.

In a Proc PROCA there are 10 steps.This proc is called by 5 different Jcls
by passing a parameter to the proc PROCA.Based on this parameter only one step among the first five steps should be executed and all the steps starting from step 6 should be executed for a given JCL.
How to check the content of a parameter inside a PROC?
EX:
Inside JCLA:
//KKKK EXEC PROCA,prov=EP000
=================
Inside the proc:

//PROCA prov=some default value
//*Now, if prov=EP000,then step1 should be executed ENDIF
//*IF prov=CAP00,then step 2 should be executed ENDIF

//*IF prov=BAP00,then step 5 should be executed ENDIF
//*remaining steps in the proc starting from STEP6.



Thanks for your time.
Back to top
View user's profile Send private message Send e-mail
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Jun 20, 2006 5:32 am    Post subject: Reply with quote

The first step of the PROC needs to be a program that is passed the value of the parameter PROV, interrogates its value, and sets the RETURN-CODE for that step as a result (probably using a value of 1 to 5).

The other steps can than check for the RETURN-CODE value from STEP1

Code:

////PROCA PROV=some default value
//PS01 EXEC PROG1,PARM='&PROV'
//*
// IF (PS01.RC = 1) THEN   PROV=EP000
//PS02 EXEC PROG2
// ENDIF
//*
// IF (PS01.RC = 2) THEN   PROV=CAP000
//PS03 EXEC PROG3
// ENDIF
//*
...
// IF (PS01.RC = 5) THEN   PROV=BAP000
//PS05 EXEC PROG5
// ENDIF
Back to top
View user's profile Send private message
THRIVIKRAM
Beginner


Joined: 03 Oct 2005
Posts: 70
Topics: 34

PostPosted: Tue Jun 20, 2006 5:37 am    Post subject: Reply with quote

Thanks,but Iam constarained to not write a new program and move into production.

All the thing I can do is edit this proc PROCA or at max edit all the five JCLS.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jun 20, 2006 7:33 am    Post subject: Reply with quote

Thrivikram,

Introduce another symbolic parameter named stp in your proc. So every time you pass the symbolic value to PROV, pass the value to STP the step no you want to process. for ex: if you are passing a value of EP000, and you want to run step1 only then pass a value of '1' to the symbolic STP. we use that symbolic in the IF clause and run the desired step. Run this JCL and see how it works.


Code:

//IFPROC  PROC PROV='     ',STP=' '               
//*                                               
//STEP1     IF (1 EQ &STP) THEN                   
//STEP0100  EXEC  PGM=IEFBR14                     
//FILE01    DD DSN=USERID.&PROV..DSN,             
//             DISP=(NEW,CATLG,DELETE),           
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1,),RLSE),           
//             DCB=(LRECL=080,RECFM=FB,BLKSIZE=0) 
//          ENDIF                                 
//*                                               
//STEP2     IF (2 EQ &STP) THEN                   
//STEP0200  EXEC  PGM=IEFBR14                     
//FILE01    DD DSN=USERID.&PROV..DSN,             
//             DISP=(NEW,CATLG,DELETE),           
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1,),RLSE),           
//             DCB=(LRECL=080,RECFM=FB,BLKSIZE=0) 
//SYSPRINT DD  SYSOUT=*                           
//SYSOUT   DD  SYSOUT=*                           
//SYSIN    DD DUMMY                               
//        ENDIF                                   
//STEP3     IF (3 EQ &STP) THEN                   
//STEP0300  EXEC  PGM=IEFBR14                     
//FILE01    DD DSN=USERID.&PROV..DSN,             
//             DISP=(NEW,CATLG,DELETE),           
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1,),RLSE),           
//             DCB=(LRECL=080,RECFM=FB,BLKSIZE=0) 
//SYSPRINT DD  SYSOUT=*                           
//SYSOUT   DD  SYSOUT=*                           
//SYSIN    DD DUMMY                               
//        ENDIF                                   
//   PEND                                         
//GO  EXEC IFPROC,PROV='BP000',STP='3'             


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Jun 20, 2006 7:34 am    Post subject: Reply with quote

<<edited>>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group