Displaying the files used by programs
You can use the Display Program Reference (DSPPGMREF) command to determine which files, data areas, and other programs are used by a program. This information is available for compiled programs only and can be displayed, printed, or written to a database output file (OUTFILE).
When a program is created, the information about certain objects used in the program is stored. This information is then available for use with the DSPPGMREF command.
The following table shows the objects for which the high-level languages and utilities save information.
The stored file information contains an entry (a number) for the type of use. In the database file output of the DSPPGMREF command (built when using the OUTFILE parameter), this is specified as:
Language or utility Files Programs Data areas See Notes CL Yes Yes Yes 1 COBOL/400® Yes Yes No 2 CSP Yes Yes No 3 DFU Yes N/A N/A FORTRAN/400 No No N/A ILE C/C++ No No N/A ILE COBOL Yes Yes Yes 2 ILE RPG Yes Yes Yes PL/I Yes Yes N/A 2 RPG/400® Yes Yes Yes 4 SQL Yes N/A N/A Notes:
- All system commands that refer to files, programs, or data areas specify in the command definition that the information should be stored when the command is compiled in a control language (CL) program. If a variable is used, the name of the variable is used as the object name (for example, &FILE); If an expression is used, the name of the object is stored as *EXPR. User-defined commands can also store the information for files, programs, or data areas specified on the command. See the description of the FILE, PGM, and DTAARA parameters on the PARM or ELEM command statements in the Control language (CL) topic.
- The program name is stored only when a literal is used for the program name (this is a static call, for example, CALL 'PGM1'), not when a COBOL/400 identifier is used for the program name (this is a dynamic call, for example, CALL PGM1).
- CSP programs also save information for an object of type *MSGF, *CSPMAP, and *CSPTBL.
- The use of the local data area is not stored.
- Code
- Meaning
- 1
- Input
- 2
- Output
- 3
- Input and Output
- 4
- Update
- 8
- Unspecified
Combinations of codes are also used. For example, a file coded as a 7 would be used for input, output, and update.
Parent topic:
Displaying information about database files
Related concepts
Control language
Related reference
Display Program Reference (DSPPGMREF) command