Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ISAM Concepts

FairCom DB provides a set of high-level functions for manipulating your data and index files collectively termed ISAM functions.

Indexed

Sequential

Access

Method

These functions perform multiple file and index access operations for each function call, whereas low-level functions operate on only one individual data file or index file per call. ISAM routines are strongly recommended, especially for client/server based applications, because the quantity of functions required to send over a network with ISAM level calls is much less than with low-level functions.

ISAM routines assume that relationships among data and index files is hierarchical in the sense that each data file may have many indexes, while each index relates to only one data file.

For example, an accounts payable system may define a vendor data file indexed by vendor name and vendor number, and an invoice data file indexed by vendor number and invoice number. In this case, each of the data files has two indexes. Although each of the data files is indexed by vendor number, there is a separate vendor number index for each data file.

The ISAM routines also assume that the key values for each index can be derived from the contents of the data records of the associated data file. As described later, the Key Segment parameters specify how to extract a key value from a data record.

As an example of how the ISAM functions perform multiple actions, consider the following sequence of events. We want to open a data file and its two associated indexes, find the first key value in an index, and read the associated data record into memory. With low-level c-tree functions the steps would be (the c-tree function used is in parentheses):

  • Initialize c-tree (InitCTree())
  • Open the data file (OpenCtFile())
  • Open the first index file (OpenCtFile())
  • Open the second index file (OpenCtFile())
  • Find the first key (FirstKey())
  • Read the record (ReadData())

Six total steps.

The same procedure, using the ISAM functions, would be as follows:

  • Initialize c-tree (InitISAM())
  • Open the data file and the two indexes (OpenIFile())
  • Find the first key and read the record (FirstRecord())

Half the steps of a low-level sequence! ISAM functions save you work, and make your code easy to follow and maintain.

TOCIndex