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

If else usage for different conditions


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Sat Apr 12, 2008 3:55 pm
Reply with quote

Hi,

How can i execute 4 different programs based on 2 field values in my input file.
My input file is of rec length = 10 and it is as follows
Code:

NAME VALUE
SEQ  1     
ORD  1     

Always there will be two records with names Seq and Ord.
Position 1,5 will have the name and
Position 6,5 will have the value
The possible values for seq num and ord num are
Code:

SEQ ORD
1   1   
1   2   
2   1   
2   2   


So
If Seq=1 and Ord=1
Exec=Pgm1
Else if Seq=1 and Ord=2
Exec=Pgm2
Else if Seq=2 and Ord=1
Exec=Pgm3
Else
Exec=Pgm4
End-if

How can i do this using jcl.
I think by using SORT and NULLOUT=RC* i can do this. Am i right.
If so how can i assign maxcc value for all the four conditions.
I need some guidence regarding this.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Apr 12, 2008 8:54 pm
Reply with quote

Other than running four (or three if you want to default the last one) sorts and using condition checking, I can't see a way of doing this with sort.
It would take the tinyest COBOL bit of coding to set the return code to one of the four values you need in a single pass.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Sun Apr 13, 2008 1:25 am
Reply with quote

bhaskar_kanteti,
Quote:
I think by using SORT and NULLOUT=RC* i can do this. Am i right

Please check with the following code for your requirement.
Code:
// EXEC PGM=IEFBR14                                                             
//DELETE DD DSN=TEMPIN,DISP=(MOD,DELETE,DELETE)                                 
//S1 EXEC PGM=ICETOOL                                                           
//TOOLMSG DD SYSOUT=*                                                           
//DFSMSG DD SYSOUT=*                                                           
//IN DD *                                                                       
SEQ  2                                                                         
ORD  2                                                                         
/*                                                                             
//TEMPIN DD DISP=(,CATLG),LRECL=80,RECFM=FB,SPACE=(CYL,1),                     
// DSN=TEMPIN                                                                   
//TEMP DD DSN=&&TEMP,DISP=(,PASS)                                               
//TOOLIN DD *                                                                   
 COPY FROM(IN) TO(TEMPIN) USING(CTL1)                                           
 COPY FROM(TEMPIN) TO(TEMP) USING(CTL2)                                         
 COUNT FROM(TEMP) LOWER(2) RC4                                                 
/*                                                                             
//CTL1CNTL DD *                                                                 
 INREC OVERLAY=(11:SEQNUM,1,ZD)                                                 
//CTL2CNTL DD *                                                                 
 INCLUDE COND=((11,1,ZD,EQ,+1,AND,6,5,CH,EQ,C'1'),OR,                           
               (11,1,ZD,EQ,+2,AND,6,5,CH,EQ,C'1'))                             
/*                                                                             
// IF (RC = 0) THEN                                                             
//PGM1 EXEC PGM=PGM1                                                           
// ELSE                                                                         
//S2 EXEC PGM=ICETOOL                                                           
//TOOLMSG DD SYSOUT=*                                                           
//DFSMSG DD SYSOUT=*                                                           
//TEMPIN DD DSN=TEMPIN,DISP=SHR                                                 
//TEMP DD DSN=&&TEMP,DISP=(,PASS)                                               
//TOOLIN DD *                                                                   
 COPY FROM(TEMPIN) TO(TEMP) USING(CTL1)                                         
 COUNT FROM(TEMP) LOWER(2) RC4                                                 
/*                                                                             
//CTL1CNTL DD *                                                                 
 INCLUDE COND=((11,1,ZD,EQ,+1,AND,6,5,CH,EQ,C'1'),OR,                           
               (11,1,ZD,EQ,+2,AND,6,5,CH,EQ,C'2'))                             
/*                                                                             
// IF (S2.RC = 0) THEN                                                         
//PGM2 EXEC PGM=PGM2                                                           
// ELSE                                                                         
//S3 EXEC PGM=ICETOOL                                                           
//TOOLMSG DD SYSOUT=*                                                           
//DFSMSG DD SYSOUT=*                                                           
//TEMPIN DD DSN=TEMPIN,DISP=SHR                                                 
//TEMP DD DSN=&&TEMP,DISP=(,PASS)                                               
//TOOLIN DD *                                                                   
 COPY FROM(TEMPIN) TO(TEMP) USING(CTL1)                                         
 COUNT FROM(TEMP) LOWER(2) RC4                                                 
/*                                                                             
//CTL1CNTL DD *                                                                 
 INCLUDE COND=((11,1,ZD,EQ,+1,AND,6,5,CH,EQ,C'2'),OR,                           
               (11,1,ZD,EQ,+2,AND,6,5,CH,EQ,C'1'))                             
/*                                                                             
// IF (S3.RC = 0) THEN                                                         
//PGM3 EXEC PGM=PGM3                                                           
// ELSE                                                                         
//PGM4 EXEC PGM=PGM4                                                           
// ENDIF                                                                       
// ENDIF                                                                       
// ENDIF                                                                       
// EXEC PGM=IEFBR14                                                             
//DELETE DD DSN=TEMPIN,DISP=(MOD,DELETE,DELETE)                                 
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Sat May 17, 2008 12:12 pm
Reply with quote

Hi shankar,

Thankyou so much.
Its working.
Sorry for late response.
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 How to load to DB2 with column level ... DB2 6
No new posts Db2 SQL - how to switch among differe... DB2 18
No new posts To search DB2 table based on Conditio... DB2 1
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
Search our Forums:

Back to Top