Find all programs that use a certain file on an ISeries AS/400

I have a problem with a certain file and need to reference all programs that use this file.  Is there a command or cross reference I can run to locates these programs?
Who is Participating?
Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
The DSPPGMREF command allows you to dump a list of objects referenced by a particular program (or group of programs) to the screen, to a spooled file, or to a database file.  this can be a VERY long running command if you run it over a large set of objects.  I suggest submitting a series of commands, perhaps library by library, rather than doing something like *ALLUSR.  submit the command to batch.

If the file has logicals, indexes, or views created over it, remember that you probably need to search the DSPPGMREF output for all of those, too.

Another great tools it to turn on journaling for that database file (or inspect the journal receiver if journaling is already in use).  Journal receivers log the date, time, program, user, job, and details of every change to every record of a journaled file.  Be aware that journal receivers can grow very large on frequently-maintianed files.  the Bacup and Recover manual (or section of the Information Center) can provide more informationon journaling.    

- Gary Patterson
tliottaConnect With a Mentor Commented:

Be aware that Gary's reference to journaling might be your only way to locate all references.

File references can be 'symbolic' through the use of variables that hold the actual file names or 'indirect' through the use of logical views or aliases. Overrides (e.g., OVRDBF) can redirect to a file.

And SQL can really interfere.

But a journal will still be notified when the file is accessed, regardless of symbols, indirection, SQL, whatever.

Also, there is database journaling and there is object (audit) journaling. The system audit journal can log object read and object change actions. That is separate from any database journaling, and it logs very different information. The database journal is more focused on the data spaces and what happens to the data. The audit journal is more focused on the object itself rather than its content.

The appropriate methods for locating references to files can depend on the methods used by the developers of the programs. Just be aware that you might need to do some detective work if you need to find everything. Some references can be fairly well obscured.

Gary's got you started with the most likely tool -- DSPPGMREF. If you run into questions, keep asking for more info.

Gary PattersonVP Technology / Senior Consultant Commented:

I'm glad you brought that up.  As database files are more and more frequently accessed from non-native programs, DSPPGMREF loses more and more of it's value.


If all you are concerned about are direct references in traditional CL, RPG, and COBOL programs, the DSPPGMREF is very good.

Personally, if I need to track down what program is causing a data problem, I almost always use database journaling, unless it is a file that is only modified in a very few places.   It is fantastic for intermittent problems, or problems caused by client-server applications.  Database journaling catches every single change to the journaled file, even changes to files through system utilities or APIs like interactive SQL, DFU, remote DDM, DRDA, ODBC, etc.
- Gary Patterson

Hawkeye PATHFINDER is the most advanced and comprehensive documentation, cross reference, and impact analysis software available for the IBM AS/400.
The package will analyze files, programs, and fields, along with other system or user objects, and place that information on a workstation, printer or in an outfile within seconds. Beyond cross reference, PATHFINDER also contains numerous utilities for managers, operators, programmers, and security officers.

PATHFINDER is designed to allow you to accomplish your development tasks without ever leaving the package.
Use Hawkeye is you have. Or DSPPGMREF.
All Courses

From novice to tech pro — start learning today.