Mahesh
Mahesh

Reputation: 1

How to get a list of programs which are using same physical file in As400?

For example, if TESTPF is a file and and it is used in PGM1, PGM2..... PGM10. And If I want to get a list of all these programs name, Is there any command or method to get the list ?

Upvotes: 0

Views: 1866

Answers (2)

jmarkmurphy
jmarkmurphy

Reputation: 11473

Yes. The command is DSPPGMREF. This command returns (either to the screen, or an outfile) all the programs and files that a program references. You can run this command over all the programs in a library with output to a file, and then query the file to find all programs that reference a given file.

DSPPGMREF PGM(MYLIB/*ALL)        
          OUTPUT(*OUTFILE)       
          OBJTYPE(*ALL)          
          OUTFILE(MYLIB/MYLIBREF)

Then:

SELECT WHLIB, WHPNAM
FROM MYLIB/MYLIBREF
WHERE WHFNAM = 'TESTPF'

NOTE: If you are using logical files, the referenced file name will be the logical file, not the physical file.

Upvotes: 2

Charles
Charles

Reputation: 23783

Check out the Display Program References (DSPPGMREF) command.

Output the results to a file, OUTPUT(*FILE) and you can use SQL to query it.

Upvotes: 0

Related Questions