The IBM i Control Language (CL) provides such a rich set of commands that even after almost 30 years, I can still discover something really useful. DSPPGMREF is a case in point:
The Display Program References (DSPPGMREF) command provides a list of the system objects referred to by the specified programs.
Usefully, I can select all programs in a library and direct the output to a database file:
DSPPGMREF PGM(LSCLIB/*ALL) OUTPUT(*OUTFILE) OUTFILE(LSCLIB/CROSSREF)
This gives me a table showing every object referenced by every program in library LSCLIB which means that identifying the potential impact of (for example) a change to a table is only a simple query away.
The program or programs to search can be *ALL, as above, or a single program name or a generic name. And if I use this:
DSPPGMREF PGM(*ALLUSR/*ALL) OUTPUT(*OUTFILE) OUTFILE(LSCLIB/CROSSREF)
I’ve captured everything.