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
 

 

Regarding the loop in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
chandub22

New User


Joined: 17 Jun 2005
Posts: 4

PostPosted: Fri Jun 17, 2005 3:04 pm    Post subject: Regarding the loop in JCL
Reply with quote

I have folllwoing scenerio.
I have input file as GDG.
Step 1

If First version is present then

Go to Step 2

Step 2
EXEC pgm=ABC

In short I need to perform Step 2 as many times as the number of Versions of GDG.
How do I do that Please help.
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jun 17, 2005 3:21 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

You simply want to execute STEP2 the number of times, you have member in GDG

or

You want to Execute STEP2 with using each version of GDG

Regards,

Priyesh.
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: Fri Jun 17, 2005 3:24 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

You are only allowed to have one Version for each Generation of a GDG. Based on your requirement, STEP2 would only need to execute once.

Are you sure that you don't want to execute STEP2 for each Generation of the GDG instead?
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Jun 17, 2005 3:39 pm    Post subject:
Reply with quote

In my opinion you can have two solutions:
1) use a proc and pass to it all the level that you want to process:
Code:
//*------- Check if level 1 exist -------*
//STEP010I EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT =*
//SYSIN    DD *
 LISTCAT ENTRIES(MYGDG.G0001V00)
/*
//MYPROC PROC
//PROC010P EXEC PGM=MYPGM,COND=(0,EQ,STEP010I)
//INPUT   DD DISP=SHR,DSN=MYGDG(&VER.)
// PEND
//*- Use of defined PROC
//STEP020P EXEC MYPROC,VER='00'
//STEP030P EXEC MYPROC,VER='-1'
//STEP040P EXEC MYPROC,VER='-2'
...
//STEP0nnP EXEC MYPROC,VER='-n'


2) you can write a rexx program that call your program and so you can pass in it all the generetion data group that you need and checkin in the program all you want. This solution require some sample if you don't know rexx.

Tell us your doubt and I we are wrong be more clear in your explanation.
Back to top
View user's profile Send private message
chandub22

New User


Joined: 17 Jun 2005
Posts: 4

PostPosted: Fri Jun 17, 2005 4:04 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

Hi
BAsically My requremnt is that I need to check how many versions are there in GDG ( say I have 3 versions ) then I need to run pgm in Step 2 for 3 times .
Back to top
View user's profile Send private message
chandub22

New User


Joined: 17 Jun 2005
Posts: 4

PostPosted: Fri Jun 17, 2005 4:13 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

priyesh.agrawal wrote:
You simply want to execute STEP2 the number of times, you have member in GDG

or

You want to Execute STEP2 with using each version of GDG

Regards,

Priyesh.

Hi Priyesh
Thanks for quick reply
Let me make my requirement more clear .
My input may vary. That is at any point of time there can be either 1,2,3 or any number of GDG versions.
Once I know there is 1 version I will go to step 2 . In step 2 pgm will do some validadaion and write into a output GDG.
Then Jcl will again check if there is 2 nd version of GDG if it finds then agin I will execute step 2 . IF there is no GDG version IDCAMS will give me error code 8 and I will not execute step 2 in that case.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jun 17, 2005 4:14 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

Then think using LISTCAT in IDCAMS U can get the total generations of that GDG....and u can run ur STEP2 that number of times with the help of a counter..

Regards,

Priyesh.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 241
Location: Cincinnati OH USA

PostPosted: Fri Jun 17, 2005 8:21 pm    Post subject:
Reply with quote

If there is no need to know which generation you performed the validation upon, then simply specify the GDG base name and all versions will be processed by step 2 in a single execution.

If this is a recriing process where the generations are deleted at the end of each run, created an empty version (IEBGENER or SORT COPY from DUMMY) to ensure the GDG always has one version to process. If necessary, IDCAMS PRINT COUNT(1) RC can tell if there are any records to process.

Dave
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: Fri Jun 17, 2005 8:33 pm    Post subject: Re: Regarding the loop in JCL
Reply with quote

This is just one possible solution:
Code:

//*                                                                   
//STEP1A   EXEC PGM=IDCAMS                                             
//SYSPRINT DD   DSN=&&T1,DISP=(,PASS),UNIT=VIO,SPACE=(CYL,(1,1),RLSE) 
//SYSIN    DD   *                                                     
  LISTCAT LVL(HLQ.MYGDG) ALL                                       
/*                                                                     
//STEP1B   EXEC PGM=ICETOOL                                           
//TOOLMSG  DD   SYSOUT=*                                               
//DFSMSG   DD   SYSOUT=*                                               
//LISTCAT  DD   DSN=&&T1,DISP=(OLD,PASS)                               
//OUT      DD   DSN=&&T2,DISP=(,PASS),UNIT=VIO,SPACE=(CYL,(1,1),RLSE) 
//TOOLIN   DD   *                                                     
 COPY FROM(LISTCAT) TO(OUT) USING(ICE1)                               
 COUNT FROM(OUT) EMPTY                                                 
/*                                                                     
//ICE1CNTL DD   *                                                     
 OPTION VLSHRT                                                         
 OUTFIL FNAMES=OUT,CONVERT,                                           
   OUTREC=(22,44,80:X),                                               
   VLFILL=X'40',                                                       
   INCLUDE=(6,7,CH,EQ,C'NONVSAM')                                     
/*                                                                     
// IF (STEP1B.RC = 0) THEN                                             
//STEP2    EXEC PGM=ICEGENER                                           
//SYSUT1   DD   DSN=HLQ.MYGDG(0),DISP=(OLD,DELETE,KEEP)           
//SYSUT2   DD   SYSOUT=*                                               
//SYSPRINT DD   SYSOUT=*                                               
//SYSIN    DD   DUMMY                                                 
//*                                                                   
//STEP3    EXEC PGM=ICEGENER                                           
//SYSUT1   DD   DSN=&SYSUID..JCL(MYJOB)                               
//SYSUT2   DD   SYSOUT=(*,INTRDR)                                     
//SYSPRINT DD   SYSOUT=*                                               
//SYSIN    DD   DUMMY                                                 
// ENDIF                                                               
//*                                                                   
Back to top
View user's profile Send private message
chandub22

New User


Joined: 17 Jun 2005
Posts: 4

PostPosted: Mon Jun 20, 2005 10:43 am    Post subject:
Reply with quote

dneufarth wrote:
If there is no need to know which generation you performed the validation upon, then simply specify the GDG base name and all versions will be processed by step 2 in a single execution.

If this is a recriing process where the generations are deleted at the end of each run, created an empty version (IEBGENER or SORT COPY from DUMMY) to ensure the GDG always has one version to process. If necessary, IDCAMS PRINT COUNT(1) RC can tell if there are any records to process.

Dave

Hi Dave
Thanks for the suggestion. But there is some gap between my and your understanding. Basically step 2 produces 2 output reports and I need separate set of output reports for each GDG version. Effectively once I read the first version of GDG then I will go to step 2 , perform the Module in Step 2 and then it will produce 2 output reports. Then I will read second version and so on till n number of versions of GDG.
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 save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts print out the correct info in LOOP? jackzhang75 CLIST & REXX 7 Wed Dec 23, 2015 10:39 pm
No new posts Using different values for Skeleton d... venksiv CLIST & REXX 8 Thu Sep 03, 2015 5:28 pm
No new posts Issue with Do Loop. santosh_g CLIST & REXX 5 Tue May 12, 2015 9:24 am
No new posts A cursor within a multi-fetch cursor ... Rohit Umarjikar DB2 1 Thu Mar 06, 2014 9:43 am


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