home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / btree / btriev14 / stats.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-10-27  |  1.5 KB  |  50 lines

  1. PROGRAM Stats;               { (C) 1991 John C. Leon   last updated 10/19/91 }
  2.  
  3. {
  4. This program will report stats on ANY Btrieve file.  Just supply the name of
  5. any valid Btrieve file on the command line or when prompted.  We are not
  6. concerned with the record layout of a file at all in this example program.
  7. We just want stats, to illustrate use of the BFile object.
  8. }
  9.  
  10. {$IFDEF production} {$D-,R-,L-,S-} {$ENDIF}
  11.  
  12. USES
  13.    BTP;
  14.  
  15. VAR
  16.    Example   : PBFile;
  17.    MyFileName: string;
  18.  
  19. BEGIN
  20.    if paramcount < 1 then
  21.       begin
  22.       write('Enter name of a Btrieve file: ');
  23.       readln(MyFileName);
  24.       end
  25.       else
  26.       MyFileName := paramstr(1);
  27.    Example := new(PBFile, Init(MyFileName, ReadOnly));
  28.    if BStatus <> 0 then
  29.       writeln('Error initializing Btrieve file object.  Sorry!')
  30.       else
  31.       begin
  32.       writeln;
  33.       writeln('Btrieve file name: ', MyFileName);
  34.       writeln('----------------------------');
  35.       with Example^ do
  36.          begin
  37.          writeln('Record length is: ', Specs.RecLen);
  38.          writeln('Page size is    : ', Specs.PageSize);
  39.          writeln('Number keys     : ', Specs.NumKeys);
  40.          writeln('Number segments : ', NumSegs);
  41.          writeln('Number records  : ', NumRecs);
  42.          writeln('----------------------------');
  43.          BStatus := Close;
  44.          end;
  45.       if BStatus <> 0 then
  46.          writeln('File could not be closed.  Status = ', BStatus);
  47.       end;
  48.       dispose(Example, Done);
  49. END.
  50.