Index File - File Header

The file header is located at offset 0 within the index file. The first 128 bytes are the same as a standard variable structure file header, except for the fields below.

Offset Size Description
0 4 The first 4 bits are always set to 3 (0011 in binary), indicating that this is a system record. The remaining bits contain the size of the nodes in the index, which is calculated using the nodesize configuration option minus the 2 bytes used here to specify system record and node size.

For example, the default value of nodesize is 1024, therefore, the first 4 bits in this case would be x"30FE.

4 2 Database sequence number, used by add-on products.
6 2 Integrity flag. Indexed files only. If this is non-zero when the header is read, it indicates that the file is corrupt.
8 14 Creation date and time in YYMMDDHHMMSSCC format.
22 14 For internal use.
36 2 For internal use.
38 1 For internal use.
39 1 Always contains value 2 for indexed organization.
40 1 For internal use.
41 1 Data compression routine number:
0
No compression
1
CBLDC001
2-127
Reserved for internal use
128-255
User-defined compression routine number
42 1 For internal use.
43 1 Indexed files only - type of indexed file.
44 4 For internal use.
48 1 Recording mode:
0
Fixed format
1
Variable format

For indexed files, the recording mode field of the .idx file takes precedence.

49 5 For internal use.
54 4 Maximum record length. Example: with a maximum record of length 80 characters, this field will contain x"00 00 00 50".
58 4 Minimum record length. Example: with a minimum record length of 2 characters, this field will contain x"00 00 00 02".
62 14 Always contains zeros.
76 1 Reserved. Set to 4.
77 31 Always contains zeros.
108 4 Version and build data for the indexed file handler creating the file.
112 8 For internal use.
120 8 Offset of logical end of the index file.

The remainder of the file header contains the following fields:

Offset Size Description
128 8 Offset of logical end of the data file.
136 1 Value 2.
137 1 Value 2.
138 1 Value 4.
139 1 Value 4.
140 2 Contains the number of keys defined for the file.
142 1 Value 0, or 1 if duplicate occurrence records are present. See the topic Types of Indexed File for details.
143 1 Value 2 or 4. Number of bytes used for occurrence numbers in indices where duplicates are permitted.
144 8 Offset of the first key information record.
152 8 Offset of the free space record for the data file.

For fixed format files, this is a record in the index file of the same format as the index free space record, but the addresses point to free records in the data file. For variable format files, this is the address in the data file of the data free space record. This record has a different structure to the index free space record.

160 8 Offset of the first free space record in the index file.
168 4 Value zeros.
172 4 Index file record length (node size).
176 8 A unique sequence number used to compare the state of a file against specific transaction log entries during the rollback recovery process.
184 328 Reserved. Value zeros. For node size 512.
  840 Reserved. Value zeros. For node size 1024.
  3912 Reserved. Value zeros. For node size 4096.