In a Btrieve file, variable length records consist of two parts: a fixed length part and a variable length part. Fixed length records consist of only the fixed length part.
For variable length records, the fixed length part of the record is usually determined by the minimum record length defined in your COBOL program. However, depending on the number of keys which allow duplicates and the page size used, Btrieve may impose restrictions on the maximum length of the fixed part of the record. The formula for determining the maximum length of the fixed part of a record is given below:
p - 6 - ( 8 * k ) [- 4 for variable length records] [- 4 for relative files]
where the parameters are:
p
|
The page size of the file. |
k
|
The number of keys that allow duplicates. |
Note:
Notes:
- If you try to create a Btrieve file with fixed length records and specify a record length that is greater than the maximum size allowed for the fixed part of the Btrieve record, the file is created as a variable length Btrieve file with the fixed part set to the maximum size allowed
- If you try and create a Btrieve file with variable length records and specify a minimum record length that is greater than the maximum size allowed for the fixed part, the file is created with the fixed part set to the maximum size allowed
- Btrieve requires that all the keys are defined in the fixed part of a Btrieve record
- Relative files are created as Btrieve keyed files with a four-byte auto-increment key at the front of each record. This processing of the key is transparent to the user program. However, the physical Btrieve file has a fixed record length four bytes larger than that calculated using the above formula.