Viewing Data File Statistics
This section includes information about generating a report that contains a data file’s characteristics and statistics using STAT.
Stat
The STAT command generates a report that contains defined characteristics of a data file and statistics about the file’s contents. Using the STAT command is a good way to determine if a file can be logged by the database engine’s transaction durability feature. The STAT command reports indexes the same whether they were created by the Create Supplemental Index operation (in Btrieve 6.0 and later) or the Create operation.
Format
BUTIL -STAT <sourceFile> [/O<owner | *>] [/O<owner | *>] [/UIDuname /PWDpword [/DBdbname]]
/Oowner
/UID<name>
/UIDuname
/PWD<word>
/PWDpword
Specifies the password for the user who is identified by uname. Pword must be supplied if uname is specified.
/DB<name>
/DBdbname
Example
The following example reports file statistics for the PATIENTS.DTA file. The data file does not have an owner name.
butil -stat patients.dta
The following example shows the resulting report:
**************************************************
File Statistics for PATIENTS.DTA
 
File Version = 8.00
Page Size = 2048
Page Preallocation = No
Key Only = No
Extended = No
 
Total Number of Records = 16
Record Length = 104
Record Compression = No
Variable Records = No
 
Available Linked Duplicate Keys = 0
Balanced Key = No
Log Key = 1
System Data = No
Total Number of Keys = 3
Total Number of Segments = 4
 
Key  Segment Position Length  Type  Flags Null Values*  Unique  ACS Values
0    1       21       20      String MD   --            16       0
0    2        7       12      String MD   --            16       0
1    1        1        6      String M    --            16       0
2    1       83       10      String MD   --            7        0

Alternate Collating Sequence (ACS) List:
0 UPPER
 
Legend:
< = Descending Order
D = Duplicates Allowed
I = Case Insensitive
M = Modifiable
R = Repeat Duplicate
A = Any Segment (Manual)
L = All Segments (Null)
* = The values in this column are hexadecimal.
?? = Unknown
-- = Not Specified
This example shows that the file called PATIENTS.DTA is an 8.0 file. (The version number indicates the earliest Btrieve version that can read the file format.) The file has a page size of 2,048 bytes and has no preallocated pages. This is not a key-only file, nor is it an extended file.
Sixteen records have been inserted into the file. The file was defined with a record length of 104 bytes, does not use record compression, and does not allow variable-length records.
There are no linked duplicate keys available in the file. The file does not use balanced indexing. The MicroKernel performs logging using Key 1, and the file contains no system-defined data. The file has three keys comprised of four key segments.
*Note: Indexes created with Sindex are designated with the letter R by default unless you specified the Reserved Duplicate Pointer element.
The STAT report also provides information about specific keys. For example, the report shows that Key 0 allows duplicates, is modifiable, and consists of two segments:
Key 1 is the key the database engine uses in logging this file. Key 1 consists of one segment. It starts in position 1, is six characters long, does not allow duplicates, is modifiable, and will be sorted as a STRING type. Sixteen unique values were inserted for this key. This key uses the upper.alt alternate collating sequence file.
Key 2 consists of one segment. It starts in position 83, is 10 characters long, allows duplicates, is modifiable, and will be sorted as a STRING type. Seven unique key values were inserted for this key. This key uses the upper.alt alternate collating sequence file.
File Version Notes
When reporting the file format version for a file, the database engine reports the earliest engine version that can read the specified file. For example, you may have a file that was created in Btrieve 5.x format, but it may be reported as a version 3.x file because it does not use any 4.x or 5.x features. Starting with the 6.x format, the file itself contains a version stamp. Prior to 6.x, the only way to determine the file format version of a file is by inspecting the features that it uses. For version 5.x or earlier files, the next table shows the features which, if used, determine the version that is reported for the file: