ISAM concepts

KISAM is an example of an ISAM, that is an Indexed Sequential Access Method. Tables in KISAM are represented as separate files in the file system with area within the files, called extents, reserved for the data records with other extents in the same file reserved for index information. KISAM uses B+ tree indices to find records using keys. A KISAM table can have up to 18 indices with each index key composed of up to 8 key segments. An index can be constrained to have unique values or it may permit duplicate values.

Records in the table can be accessed in three ways. Sequentially along an index path, randomly by key or randomly by rowid.

In sequential access a index path is established with a start operation either at the beginning of the key path or at a particular key value. The program can then proceed along the key path sequentially reading records using KISAMReadNext until it gets a status of KE_ENDOFFILE (2) indicating that it has reached the end of the file. It is possible to read backwards on an index path by passing the path number as a negative number.

For random access by key the key is constructed from a record buffer with KISAMBuildKey and that key is used in KISAMReadKey which will use the index to locate the required record.