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.