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

Creation of a number of GDG bases


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
Onupz

New User


Joined: 03 Aug 2006
Posts: 3
Location: Kolkata

PostPosted: Thu Dec 27, 2007 7:37 pm
Reply with quote

Hi all,
I need JCL to define a number of GDG bases (500-600) at once.
I have the JCL for defining one GDG base:

//STEP001 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GENERATIONDATAGROUP ( -
NAME(HLQ.MLQ.LLQ) -
LIMIT(3) -
NOEMPTY -
SCRATCH )
/*

But for creating X no of GDGs I have to write X no of Steps.
Is there any other way out where I can paste the name of the files in the JCL itself or in a file and the GDGs will be created?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Dec 27, 2007 7:48 pm
Reply with quote

Onupz wrote:
But for creating X no of GDGs I have to write X no of Steps.


No, that's not true.

Onupz wrote:
Is there any other way out where I can paste the name of the files in the JCL itself or in a file and the GDGs will be created?


Can't you write a program/command list/routine that can build your DEFINE statements programatically, using a list of required files that you provide as its input?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 27, 2007 9:24 pm
Reply with quote

You can use REXX to call IDCAMS to define the GDG base, and also I have very recently put some code to create the next generation for a GDG, so you only need one REXX EXEC to both build the base and define the first generation.
Back to top
View user's profile Send private message
Onupz

New User


Joined: 03 Aug 2006
Posts: 3
Location: Kolkata

PostPosted: Fri Dec 28, 2007 11:39 am
Reply with quote

But is it possible to do so through JCL?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Dec 28, 2007 2:28 pm
Reply with quote

Yes it is.
Back to top
View user's profile Send private message
Onupz

New User


Joined: 03 Aug 2006
Posts: 3
Location: Kolkata

PostPosted: Fri Dec 28, 2007 7:59 pm
Reply with quote

how?
without repeating the steps?
becuase for creating 500-600 GDGs it is not practically feasible to repeat the steps that many time and enter the file names in each step.
How can I do so by JCL in a few steps? there must be some trick..
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Dec 28, 2007 9:05 pm
Reply with quote

If you bother to read the replies, you will find that it is possible to do this in ONE REXX step.
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Dec 28, 2007 9:36 pm
Reply with quote

Onupz,

It's simple. You can create thousands of GDGs in a single IDCAMS step. Last week I got same requirement for my project and I created 1500 GDGs using a simple REXX program.

1) Create a list of GDG bases in a PS file or If you want to do more automation then write a small REXX program to read your JCL and capture GDG bases names (The dsname will be Between "DSN=" and "(+1)" in your JCL). Store all these GDG base names in a PS file.
2) Write another REXX program or continue in the same REXX above to read above file and create the JCL for creation of GDGs

Code:
/*REXX*/
address tso                                                 
"alloc da('your.jcl.library') fi(jcl) shr reuse"             
"execio * diskr jcl (stem write. finis"                     
write.1 ='//'jclname' JOB PRTY=03,'                         
write.2 ='//            REGION=8M,'                         
write.3 ='//            MSGCLASS=M,'                         
write.4 ='//            MSGLEVEL=(1,1)'                     
write.5 ='//*'                                               
write.6 ='//STEP01    EXEC PGM=IDCAMS'     
write.7 ='//SYSPRINT DD SYSOUT=*'       
write.8 ='//SYSOUT DD SYSOUT=*'                         
write.9 ='//SYSIN DD *'                                 
w = 9                                                       
"alloc da('your.gdg.list') fi(input) shr reuse"   
"execio * diskr input (stem read. finis"                     
do i = 1 to read.0 by 1                                     
   dsname = word(read.i,1)                                   
   w = w + 1                                                         
   write.w = '  DEFINE GDG(NAME('dsname')  -'                                     
   w = w + 1                                                         
   write.w = '  LIMIT(15)  SCRATCH  NOEMPTY)'                     
end                                                                 
"execio * diskw jcl (stem write. finis"     
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Dec 28, 2007 10:14 pm
Reply with quote

Why write JCL to do it ?

REXX will be able to (a) Define the GDG bases and (b) Define the first generation

All in the very same step. Only one step required once the list of GDG bases is available.

In fact, this topic was discussed very recently.
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 Dec 28, 2007 10:22 pm
Reply with quote

I too, am curious why you'd use a REXX exec to create JCL for something that the exec itself can do. I questioned the same logic in this other topic also.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Dec 28, 2007 11:31 pm
Reply with quote

As I'm in a very good mood this evening .............. icon_eek.gif

Assume - your input file has variables - gdgbase recfm lrecl, recfm & lrecl are needed unless you wish to dummy the (0) gen from the first batch run, in which case there is no need to bother allocating it in the first place.

Code:

/* REXX *** Define and build first gen GDG */
"ALLOC FI(ddname) DA('"whatever"') SHR)
"EXECIO * DISKR ddname ( STEM stemname. FINIS"
DO A = 1 TO stemname.0
 PARSE VAR stemname.A  gdgbase recfm lrecl .
 "DEFINE GDG(NAME('"STRIP(gdgbase)"') LIM(??) SCRATCH NOEMPTY"
 "ALLOC FI(NEWGEN) DA('"STRIP(gdgbase!!'.G0001V00')"') NEW TRACKS
    SPACE(1) RECFM("recfm") LRECL("lrecl")"
 "FREE FI(NEWGEN)"
END


There you go, less lines of code that you would need to write the JCL.

And if you run it in batch, just remove the 2nd line of the above code.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top