Page 1 of 1

REXX code to create GDG Bases

PostPosted: Wed Nov 05, 2014 7:33 am
by ravitejaintel
Hi,

I need a Rexx code which scans the jcl and identify the GDG's and then create respective GDG base.

For example, i opened a member TEST.REXX1.SAMPLE(MEMBER1),
when i enter any command in command line like ''GDGBASE" then press enter.. it should scan the opened member and identify the jcls and create the GDG bases.

Re: REXX code to create GDG Bases

PostPosted: Wed Nov 05, 2014 1:06 pm
by vern
Just curious .. can you explain why you have JCLs which reference GDGs but you don't already have the GDG bases ?

Re: REXX code to create GDG Bases

PostPosted: Wed Nov 05, 2014 3:39 pm
by ravitejaintel
Hi vern,

Thank you for your interet.

My scenario is to scan the job and to create GDG base if it doesn't have already a GDG base.

Re: REXX code to create GDG Bases

PostPosted: Wed Nov 05, 2014 4:13 pm
by vern
Ok. So someone created a load of JCL referencing GDGs which has never run because the GDGs don't exist ? That just seems really strange.

I doubt very much that anyone will give you any ready-made code to do this. If you don't have any tools like JCLCHECK then you'll have to write something yourself and it won't be easy. You could scan your JCL library and look for strings identifying a GDG reference ( +1, -2 and so on) and extract the dataset name. But quite likely the JCL will call PROCs and they may use GDGs, but you won't see them in the library scan.
And how do you know what LIMIT(nn) value is required for this gdg ?
It would help if you said WHY you want to do this, then maybe you'll get good advice about the best way of achieving it (which may be different to what you say you want)

Re: REXX code to create GDG Bases

PostPosted: Wed Nov 05, 2014 11:35 pm
by ravitejaintel
i am not expecting the ready made code.. Since i am a rexx beginner, i need the experts or experienced persons in the way of approach to achieve the target. i know its difficult, but we should do the impossible tasks also, right!!

I need this to automate the system which reduces the manual effort in creating the GDG's always.

I have hope that this forum will helps.

Re: REXX code to create GDG Bases

PostPosted: Thu Nov 06, 2014 12:18 am
by NicC
Actually, the IDCAMS control cards to set up the GDG base should be a documented project deliverable and should be done before the JCL is created.

You could do it as amacro or you could read the JCL, procedure or otherwise, into your program. Scan each line looking for '(+', '(-', '(0'. Get the dataset name from the same line. Generate the IDCAMS statements. Store/write.

After that you will have to check the generated statements looking for duplicates - probably OK to use your sort product to remove them. Then manually adjust the statements to the requirements of each dataset - number of generations, what to do with them when they roll off etc.

Re: REXX code to create GDG Bases

PostPosted: Thu Nov 06, 2014 12:52 pm
by vern
@ravitejaintel, sure, projects which are difficult are often the most rewarding and the ones where you learn the most ! What Nic says above is correct but you must also look for JCL which is not visible in the member because it is
(a) in a proc, i.e. // EXEC PROCNAME,..
(b) included with a // INCLUDE

One thing you might consider is submitting each job with a //TYPRUN=SCAN. The job won't run, but you will be able to see all the resolved JCL including (a) and (b). If you can get that into a dataset, you can scan it with a REXX program
Good Luck