Logical files – V5R4

1150 pts.
Tags:
DB2/400
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Supriyob2
    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 pointsBadges:
    report
  • chanduas400
    DSPFD on the LF and search for PFILE will give u the physical phile on which logical file is dependent.

    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following