Displaying objects used by programs
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:
- The name of the program or package and its text description
- The name of the library or collection containing the program or package
- The number of objects referred to by the program package
- The qualified name of the system object
- The information retrieval dates
- The object type of the referenced object
For files and tables, the record contains the following additional fields:
- The name of the file or table in the program or package
(possibly different from the system object name if an override operation
was in effect when the program or package was created) Note: Any overrides apply only on the application requester (AR).
- The program or package use of the file or table (input, output, update, unspecified, or a combination of these four)
- The number of record formats referenced, if any
- The name of the record format used by the file or table and its record format level identifier
- The number of fields referenced for each format
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® for i 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.
- Code
- Meaning
- 1
- Input
- 2
- Output
- 3
- Input and Output
- 4
- Update
- 8
- Unspecified