Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Serial Number Segments

The ISAM-level segment mode 3, SRLSEG, indicates that the key segment will automatically be filled with a signed 4 or 8-byte sequence number. An OSRL_ERR (44) error is returned when the sequence number overflows. When using a signed 4-byte value, the value is limited to 2 GB. 4-byte sequence numbers should not be used in situations where more than 2^31 (or 2,147,483,648) sequenced entries will be required. When using a signed 8-byte value, the sequence number value is limited to 2^63 (or 9,223,372,036,854,775,808).

GetSerialNbr() returns the current sequence number for data file datno used in ISAM applications using a SRLSEG key segment mode. GetSerialNbr() returns a long integer containing the current sequence number, so use ctGETHGH() to obtain the high word portion of the 8-byte value. If an error occurs (such as data file not in use), GetSerialNbr() returns a zero value. Check uerr_cod for the error code.

If a SRLSEG exists, RebuildIFile() finds the highest serial number in use and updates the file header with that value.

To manually manage serial numbers, use the OPS_SERIAL_UPD status_word described in the SetOperationState() function description.