You can use the Display Program References (DSPPGMREF) command to determine which tables, data areas, and other programs are used by a program or SQL package. This information is only available for SQL packages and compiled programs and can be displayed, printed, or written to a database output file.
When a program or package is created, the information about certain objects used in the program or package is stored. This information is then available for use with the Display Program References (DSPPGMREF) command. Information retrieved can include:
For files and tables, the record contains the following additional fields:
Any overrides apply only on the application requester (AR).
Before the objects can be shown in a program, the user must have *USE authority for the program. Also, of the libraries specified by the library qualifier, only the libraries for which the user has read authority are searched for the programs.
The following table shows the objects for which the high-level languages and utilities save information.
Language | Files | Programs | Data areas | See note |
---|---|---|---|---|
CL | Yes | Yes | Yes | 1 |
COBOL/400® Language | Yes | Yes | No | 2 |
PL/I | Yes | Yes | N/A | 2 |
RPG/400® Language | Yes | No | Yes | 3 |
DB2® UDB SQL | Yes | N/A | N/A | 4 |
Notes:
|
The stored file information contains an entry (a number) for the type of use. In the database file output of the Display Program References (DSPPGMREF) command (built when using the OUTFILE parameter), this entry is a representation of one or more codes listed here. There can only be one entry per object, so combinations are used. For example, a file coded as a 7 would be used for input, output, and update.