1,150 pts.
 Logical files – V5R4
HI we all know DSPDBR command on a PF will fetch all the dependent logical files. Can anybody tell me with a logical file's name only known is it possible to fetch the Physical files's name on whom it is dependent?

 

happy new year n best wishes to all

Ram



Software/Hardware used:
as/400,V5R4
ASKED: January 12, 2010  12:53 PM
UPDATED: January 13, 2010  7:33 AM

Answer Wiki:
DSPFD of a LF to an outfile contains the based on PF. You can read the file with SQL or RPG. ===================================================== DSPFD with TYPE(*ACCPTH) and FILEATR(*LF) will create an outfile row for each related PF. However, the system catalog LF named QSYS/QADBLDEP already contains rows for your LFs. But you really ought to query the LF object directly. The <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/qdbrtvfd.htm">Retrieve Database File Description (QDBRTVFD) API</a> looks very ugly, but it works like any other API. It just takes a little more time to locate the item you want and to follow the offsets. Here's an example that accepts a qualified LF name and extracts the first PF along with the PF library:<pre> pgm ( + &QDBF + ) dcl &QDBF *char 20 dcl &FDT_BYTRET *int 4 dcl &FDT_BYTAVL *int 4 dcl &PF *char 10 dcl &PF_LIB *char 10 dcl &FDT_OS_PF *int 4 dcl &FDT_OS *int 4 dcl &FDT *char 736 dcl &FDTLEN *int 4 value( 736 ) dcl &QRFD *char 20 dcl &ERRCODE *char 8 value( x'0000000000000000' ) /* &QDBF is file in bytes 1-10, library in 11-20 */ call QDBRTVFD ( + &FDT + &FDTLEN + &QRFD + 'FILD0100' + &QDBF + '*FIRST ' + '0' + '*LCL ' + '*EXT ' + &ERRCODE + ) /* File definition template offset to scoping array... */ chgvar &FDT_OS %bin( &FDT 317 4 ) /* Scoping array offset to PF... */ chgvar &FDT_OS_PF ( &FDT_OS + 48 + 1 ) chgvar &PF %sst( &FDT &FDT_OS_PF 10 ) /* Add 10 mores bytes for offset to PF library... */ chgvar &FDT_OS_PF ( &FDT_OS_PF + 10 ) chgvar &PF_LIB %sst( &FDT &FDT_OS_PF 10 ) dmpclpgm return endpgm</pre> Example call is:<pre>CALL PGM(mylib/RTVDBFPF) PARM('TESTLF1 mylib ')</pre> Add a parm to return the PF and library if you need it. Note that it is a scoping "array", so there will be an entry for each PF if the LF refers to more than one. Each entry is 160 bytes in length. Tom
Last Wiki Answer Submitted:  January 13, 2010  7:33 am  by  DanD   2,865 pts.
All Answer Wiki Contributors:  DanD   2,865 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

Hi..
Another way is to do fndstrpdm.. 25 & shift F1…and search with your LF in that Source file…
that way u can also know which are the pgm using it too…

 165 pts.