Find Copybook of a dataset used in JCL



IBM's Command List programming language & Restructured Extended Executor

Find Copybook of a dataset used in JCL

Postby jiteshyadav » Wed Apr 16, 2014 1:21 pm

Hi,

I have a requirement to find out the name of the copybook for a dataset used in the JCL.
The best way to do this (which I could think of) is to find the DD name and COBOL Program name from the JCL for that dataset and use DD name in COBOL program to find out the copybook. Is my approach correct/optimal?

Also, I have written Rexx code to find out the DD name & COBOL program name and it's working fine.
My concern lies in extracting the copybook name from the COBOL program as there can be multiple ways to handle files in the COBOL program.
Below are the few possibilities:
1. Copybook can be specified in FILE section under FD.
2. Or we can just give a record under FD and expand that record with COPY statement in Working Storage Section.
3. Layouts could have been REDEFINEd in the program.
4. Same file can be written with multiple record layouts for e.g. header, detail, trailer etc.

Since there is no standard way, it's hard to extract correct details and cover all the above and many others.

Any suggestions.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Find Copybook of a dataset used in JCL

Postby NicC » Wed Apr 16, 2014 2:59 pm

Another way is to not have a copybook at all. I have several datasets like that because they are leaving the mainframe and going to Excel so a copybook is not required.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Find Copybook of a dataset used in JCL

Postby jiteshyadav » Wed Apr 16, 2014 3:14 pm

Hi nicC,

But my requirement is to get the copybooks specifically.
Any suggestion in that direction will be helpful.

Thanks.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Find Copybook of a dataset used in JCL

Postby Robert Sample » Wed Apr 16, 2014 9:35 pm

You have defined the problem. Unless you (or your site) does some research and finds a tool on the market to do what you want, you are going to be stuck writing code to cover the various cases (which will take some time) -- or you can abandon the effort as not worth the trouble. Since copy books do NOT have to be related to a file, you need to consider that in your code, too.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Find Copybook of a dataset used in JCL

Postby dick scherrer » Wed Apr 16, 2014 11:39 pm

Hello,

It would indeed be difficult to identify everything using that approach.

Another approach could be to make a cross-reference of which dataset(s) are defined by which copybook(s).

Then search the production/test/personal jcl for wherever these dataseta are used. Which has the advantage of identifyiing when the datasets are used in processes that are not cobol (i.e. sort, easytrieve, etc).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Find Copybook of a dataset used in JCL

Postby jiteshyadav » Thu Apr 17, 2014 10:35 am

Hi dick,

Thanks for your suggestion.
But I don't understand what do you mean below.
dick scherrer wrote:Another approach could be to make a cross-reference of which dataset(s) are defined by which copybook(s).

How to do this cross-reference? The only place where we use layout for any dataset is in the code (COBOL, Easytrieve etc.) itself.
Can you please elaborate it a bit.

Thanks.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Find Copybook of a dataset used in JCL

Postby dick scherrer » Thu Apr 17, 2014 7:53 pm

Hello,

How to do this cross-reference?
I suspect this would largely be done by first determining which copybooks define files and which are for other uses.

Then take the copybooks that define files and enter the dataset names defined by each copybook. If this does not already exist to some degree, it will need to be entered.

I don't know about your organization, but the organizations I've supported had people who knew which copybooks went with which files. If this institutional knowledge does not exist, the gathering will take longer.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Find Copybook of a dataset used in JCL

Postby jiteshyadav » Fri Apr 18, 2014 9:58 am

Hi Dick,

I think it's just the difference of shops then. In our shop we don't have any such reference/repository of a copybook with the file from where we can know which copybook is associated with which file.
The only place where you can look for the copybook of a file is in the COBOL program.
Based on the responses above, I think there is no full proof way to identify the copybooks for all datasets as the standards vary from shop to shop.
Any way I will be giving it a shot following the approach I specified in my first post covering maximum scenarios which I can.
At least it will be helpful in some cases if not in all.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post