110 pts.
 Finding source physical files
Can you help this iSeries user? He wants to know how he can find only source physical files in any library (Ex: QDDSSRC, QCLSRC, etc.). Thanks! Michelle Davidson Editor Search400.com

Software/Hardware used:
ASKED: August 16, 2005  10:20 AM
UPDATED: January 20, 2011  5:28 AM

Answer Wiki:
USE COMMAND : STRPDM I would use PDM option 2. Work with objects: Enter the library name to search for source physical files. Under OBJECT name key: *ALL Under TYPE key: *FILE Under ATTRIBUTE key: PF-SRC Also can be done by WRKLIBPDM with library name PGMBOB: I would build a file of the physical files and select the source attribute. Try DSPOBJD *all/*all OBJTYPE(*file) output(*OUTFILE) Provide an OUTFILE library/filename. A file will be written with a format supplied by the system. Use SQL select the *File objects and attribute. Good luck
Last Wiki Answer Submitted:  January 20, 2011  5:28 am  by  Yogeshvgawande   15 pts.
All Answer Wiki Contributors:  Yogeshvgawande   15 pts. , Rigger   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The PDM option is best if you want to find a source member so you can change it. If you just want a list of where the files are you can do the following:
DSPFD FILE(library to check/*ALL) TYPE(*BASATR) OUTPUT(*OUTFILE) OUTFILE(library/file to hold output)
If the field ATFILA = *PHY and field ATDTAT = S it is a source physical file.
You can use the outfile created from the command in a query, RPG, or CL program.

 0 pts.

 

In QSYS library there is a file named QADBXREF that contains a record for every DB file on the system. There are codes on the file that say whether the file is an LF or PF and if a PF whether it is a data or source file. To get a list of source files, in SQL execute the following:

SELECT * FROM qadbxref WHERE DBXATR = ‘PF’ and
DBXTYP = ‘S’

This will get you a list of all source physical files on your iSeries. If you want just those in a particular library add selection to your WHERE.

 645 pts.

 

You can also use the Display Object Description command to locate Source Physical Files:
DSPOBJD OBJ(*ALL/*ALL)
OBJTYPE(*FILE)
OUTPUT(*OUTFILE)
OUTFILE(YOURLIB/DSPOBJDFLE)
then use WRKQRY if you have it to query the file for PF-SRC files.

 30 pts.

 

DSPOBJD finds all physical files in a library with an object type of *FILE and an object attribute of PF. Both source and physical data files are tagged this way. So unless your shop only uses Q* default names for source files and follows the IBM recommendation that you don’t name any user objects starting with Q, I don’t see how a DSPOBJD will find only source files.

File QADBXREF is built by the operating system and is constantly updated as new files are added, changed or deleted. And the data on this file knows the difference between a data or source PF.

 645 pts.

 

Note that file QSYS/QADBXREF is a physical system file that is in constant use by DB2 itself and technically should not be accessed directly. Unusual interruptions of system activity against this file can be troublesome causes of database catalog inconsistencies. The RCLSTG SELECT(*DBXREF) can help correct such inconsistencies, but database operation is somewhat unpredictable until corrections are done.

It is better to use any of the logical files and SQL views that IBM has provided to review the info. For example, logical file QADBXATR provides field DBXTYP to expose ‘D’=Data or ‘S’=Source physical file.

A full list of LFs/views can be seen from DSPDBR QADBXREF.

Tom

 108,360 pts.

 

HOW TO CHANGE THE ATTRIBUTES OF A PF WITHOUT LOOSING THE DATA

 10 pts.

 

HOW TO CHANGE THE ATTRIBUTES…
 
Can you explain how this relates to finding source files? If not, then you will be better off opening your own question. When you open your question, you need to include a list of “attributes” that you want to change.
 
Tom

 108,360 pts.