Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Optional Record Header

When a first or subsequent search call returns a data record from a variable-length data file, a data file member of a superfile, or a resource record, the data is almost always preceded by a record header. The only exception would be if TransactionHistory() could not find or properly relate the log entries needed to create the composite header and actual data image. The least significant byte of imgmap contains the length of the record header. Typical length values are:

  • 0 - no record header
  • 10 - variable-length record header
  • 18 - superfile record header
  • 22 - resource record header

The first 10 bytes of each header is comprised of:

  • 2-byte record mark
  • 4-byte total length
  • 4-byte utilized length

The record mark is 0xFAFA for an active data record, 0xFDFD for a deleted data record, and 0xFEFE for a resource record. Typically, a fixed-length data record in a superfile will have a header record mark of 0xFAFA whether active or deleted. Look at the first byte of the actual data record to determine if it is active or deleted. A deleted fixed-length data record begins with a 0xFF byte.

The total length is the space used by the header, the actual data image, plus any extra space not currently used by the record. The utilized length is the length of the actual data not including the header or any extra space. In a properly configured file, moving from the first byte of the record header by the total length should place you on the first byte of the next record in the file. TransactionHistory() usually returns the entire total length of the data image, not just the utilized length.

TOCIndex