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

Regarding the loop in JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Jun 17, 2005 3:21 pm
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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Jun 17, 2005 3:24 pm
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
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
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Jun 17, 2005 4:14 pm
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: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Fri Jun 17, 2005 8:21 pm
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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Jun 17, 2005 8:33 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
No new posts Need to read duplicate rows from tabl... DB2 3
This topic is locked: you cannot edit posts or make replies. Cobol db2 program going in loop COBOL Programming 4
No new posts Need to loop & extract from varia... CLIST & REXX 2
Search our Forums:

Back to Top