|
||||||||
|
|
![]() |
|
|
|
|
||
|
For Members Only Hey, Ted: How can I determine how many members are in a physical file? How can I determine whether the file contains the maximum number of allowable members? --Bob I suggest you use the QDBRTVFD API. It has a lot of information, most of which is not available through CL commands. In fact, it provides more information than the Display File Description (DSPFD) command does. The following CL program fragments retrieve the two pieces of information you requested, as well as two additional details: the file's text description and record length.
/* the file about which we want to retrieve information */
/* 1-10 = file name, 11-20 = library */
dcl &QualFile *char 20
/* variables needed by API QDBRTVFD */
dcl &FData *char 736 /* return variable */
dcl &FDataLen *char 4 x'000002E0' /* length of &FData */
dcl &QualRtnF *char 20 /* returned file name */
dcl &ErrorDS *char 16 x'00000000'
/* data extracted from the return variable */
dcl &MaxMbrs *dec 5
dcl &CurrMbrs *dec 5
dcl &RecLen *dec 5
dcl &Text *char 50
call qdbrtvfd (&FData +
&FDataLen +
&QualRtnF +
FILD0100 +
&QualFile +
*FIRST +
'0' +
*LCL +
*EXT +
&ErrorDS)
/* maximum members allowed in the file */
chgvar &MaxMbrs (%bin(&FData 42 2))
if (&MaxMbrs *le 0) do
chgvar &MaxMbrs 32767
enddo
/* number of members currently in the file */
chgvar &CurrMbrs (%bin(&FData 48 2))
/* text description */
chgvar &Text (%sst(&FData 85 50))
/* record length */
chgvar &RecLen (%bin(&FData 305 2))
You can find more information about QDBRTVFD at the iSeries Information Center. --Ted
|
Editors
Contact the Editors |
| Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |