Return to the Systems Tips
Poor Man's Cross-Reference
While there is no single command that gives you a list of all programs used by a file, you can query the outfile from the Display Program References (DSPPGMREF) command to give you this information. Here are the steps:
a. Run the DSPPGMREF command specifying the name of your library, *ALL for the program name, and a file name to receive the output:
DSPPGMREF PGM(YourLib/*ALL) OUTPUT(*OUTFILE) OBJTYPE(*ALL) OUTFILE(YourOutLib/YourOutFile)
If you have multiple libraries, run the command again and change the output member parameter from *REPLACE to *ADD.
b. Use Query/400 to select records where the WHFNAM field is equal to your file name:
SELECT DISTINCT WHLIB, WHPNAM, WHTEXT FROM YourOutLib/YourOutFile WHERE WHFNAM='YourFileName' ORDER BY WHLIB, WHPNAMThe above technique works, but it has its limitations. It won't list files overridden with OVRDBF, it will show logicals but not the physical file used by the logical, and it misses join OPNQRYs and DFUs and programs hidden in library lists. That's why many programmers recommend using a commercial documentation package, because they tend to have far fewer limitations. Still, though, you can't beat the price!
Thanks to all who sent in this suggestion: Bob Abbott, Paul J. Crowley, Susan Deem, Ray Gernon, Nizar S. Hajjaj, Patrick Holthuizen,
Julie Hills, Michael Lynch, and Ron Wolford. Whew!
[report a broken link by clicking here]