Newsletters Subscriptions Forums Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 66 -- October 1, 2003

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


Sponsored By
PROFOUND LOGIC SOFTWARE

RPGsp users don't settle for less!

Why settle for a tool that's just an application builder, or just a server, or just a designer, or just a green-screen converter?

You need an integrated Web development tool that can do all of the above. And you need the best!

RPGsp has what you need. Don't settle for less.

Free trial and information at www.RPGsp.com



THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
Profound Logic Software


BACK ISSUES

TABLE OF
CONTENTS

Leveraging ThreadLocal Variables in Java

For Members Only

Reader Feedback and Insights: Unix Shell Script Is as Good as CL


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.