Use DSPOBJD to create a physical file containing all the files on your system :-
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*FILE) OUTPUT(*OUTFILE) OUTFILE(YourLib/YourFile)
You may need to change the object selection to select *ALLUSR instead of *ALL – otherwise this also counts system files. Then use Query to select a count of all the records with object attribute (ODOBAT) = ‘PF’.
– or –
You can query file QADBXREF in QSYS library. Every time a PF or LF is created on the system, this file is maintained automatically and contains basic information for these files. There is a field on this file that defines the file as a PF or LF. You can query this file to get a count of PF files.
There are other files in QSYS that start with QADB that are maintained by the system as well that show fields on files, key fields on files, triggers etc.
I believe the QADBXREF only contains <b>externally described</b> physical & logical files – if you have ‘flat’ data files I don’t think they’re listed. I seem to remember this problem from back in the System/36 environment – QADBXREF was pretty empty if you only used the S/36 environment.