I have a program that reads a record from a file, but uses only a subset of the fields on that record. Is there a way, via TraceMaster, Debug, compiler option, ..., that would list the input record fields the program actually accesses?
For example, the input record layout is
10 CUST-ACCT-NO PIC X(010).
10 CUST-CUR-BLG-DY PIC X(002).
10 SUMMRY-BLG-INDR PIC X(001).
10 ASGND-BL-CYCLE PIC X(002).
By manually searching the source code I could determine that, say, the first 2 fields are used in the program but the second two are not.
The problem is: I have dozens of programs each with many input files, each with hundreds of fields. Manually eyeballing would get tedious and error prone after awhile :-(
BillWoodger 270005Q076273 Posts
Re: input data trace2012-10-15T22:05:52ZThis is the accepted answer. This is the accepted answer.If you look at the compiler options in your manual (I don't know which compiler you are using, you didn't say) you should be able to get a "cross reference" of data-names on the compile listing. This will show you the line number where defined (on the compile listing) and all lines which reference a particular field, again the line number on the listing. You'll even, probably, find useful information attached - M prefixed to the line number of the reference indicates the the field is "modified" by the reference. This is detailed at the start of the cross reference itself.
SystemAdmin 110000D4XK403 Posts
Re: input data trace2012-10-16T20:50:08ZThis is the accepted answer. This is the accepted answer.
- BillWoodger 270005Q076
We use the IBM Enterprise z/OS COBOL compiler, and the option that provides that cross reference is XREF, which generated this listing:
Defined Cross-reference of data names References
9006 ABEND-DB2-WARNINGS . . . . . . M16400
9030 ABEND-OTH-INFO . . . . . . . . M12583 M12843 M12960 M13244
581 COMPANY-CODE . . . . . . . . . 12909 12981
729 COMPANY-CODE . . . . . . . . . 11681 11993 12069 12459
This will be helpful, though I will still need to write some REXX script to aid me in wading through the tons of compiled listings I will have to go through :-).
Thank you for the info.
BillWoodger 270005Q076273 Posts
Re: input data trace2012-10-16T22:18:16ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
From the data division map, you can get all the line numbers for all the data definitions for each 01 level. They have leading-zeros suppressed, unlike the XREF. Bit of "normalisation" required.
You have the source listing, for data and procedure.
You have the Verb cross-reference, and Procedure cross-reference.
There's a lot of "information" you can pull out of all this "data", and the compiler has done the bulk of the work for you :-)
I found AWK more convenient for the processing, as its "associative arrays" make it easy. You could try to "mimic" that with pairs of stem variables, one referenced by a simple number, the value of which can be the reference for the other stem. Just a thought. Perhaps the more-traditional Rexx ways would be enough.
Once you've go the general thing up and running (to make all of that information available for use within a program), the requirement you have is a piece of cake :-)