Index File - Key Information Record

The key information record describes the physical characteristics of all the keys used in the file, including the length of each key; where the key is defined within the data record; whether duplicates are permitted, and so on. Within the key information record structure is a sub-structure, the key block. A key block is created for each key defined. The first key block always describes the primary key. Subsequent key blocks define the alternate keys in the order specified when the file was created. If the key information record is not big enough to hold key blocks for all the keys defined, equal sized continuation records are created, each pointing to the next, until all the keys have been defined.

The key information record contains:

Size Description of the field
2 Record header. Present only if index nodes have record header. See the topic the topic Types of Indexed File for details.
2
Bit 15
Security flag. Value 0.
Bits 14-0
Pointer to the end of the last key block entry in this record, relative to the start of this record.
file-pointer-size Address of continuation record. Zero if no further continuation records.
n Key block for primary key
... ...one for each alternate key in the file
n Key block
1 Reserved. Value x"FF".
1 Reserved. Value x"7E".

For all indexed file formats except IDXFORMAT"8" or IDXFORMAT"12", the key block contains:

Size Description of the field
2 Length of this entry in bytes.
4 Address of the root index node record for this key.
1 Key compression:
Bit 2
Compression of trailing spaces.
Bit 1
Compression of leading characters.
Bit 0
Compression of duplicates.
5 Key component block
... ...if the key is split, one block per component
5 Key component block

For IDXFORMAT"8" and IDXFORMAT"12" files, the key block contains:

Size Description of the field
2 Length of this entry in bytes.
1 Sparse key character.
13 Reserved.
1 Key compression:
Bit 3
Compression of trailing nulls.
Bit 2
Compression of trailing spaces.
Bit 1
Compression of leading characters.
Bit 0
Compression of duplicates.
1 Key flags:
Bit 6
Duplicates permitted.
Bit 1
Sparse key.
6 Key component block
... ...if the key is split, one block per component
6 Key component block

For all indexed file formats except IDXFORMAT"8" or IDXFORMAT"12", the key component block contains:

Size Description of the field
2
Bit 15
Duplicates permitted flag. If set, duplicates are permitted.
Bits 14-0
Length of component in bytes.
2 Offset of component within data record, starting at 0.
1 Component type. Value zeros.

For IDXFORMAT"8" and IDXFORMAT"12" files, the key component block contains:

Size Description of the field
2 Length of component in bytes.
2 Offset of component within data record, starting at 0.
1 Component flags:
Bit 6
Descending
1 Component type:
Bit 7
Numeric.
Bit 6
Signed.
Bits 5-0
If not numeric:

0 – alphanumeric

If numeric:

h"00" – DISPLAY (SIGN TRAILING INCLUDED)

h"01" – DISPLAY (SIGN TRAILING SEPARATE)

h"02" – DISPLAY (SIGN LEADING INCLUDED)

h"03" – DISPLAY (SIGN LEADING SEPARATE)

h"20" – COMP

h"21" – COMP-3

h"22" – COMP-X

h"23" – COMP-5

h"24" – FLOAT