Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Alternative Collating Sequence

Any of the key segment modes can be modified to use an alternative collating sequence by adding 32 to the mode, or OR-ing the mode with the symbolic value ALTSEG. For example, a mode of 32 (0 + 32) stores the key segment an order other than the standard ASCII collating sequence. This is especially useful for extended character sets associated with languages that do not collate correctly according to the standard ASCII sequences.

To use an alternate collating sequence, Resources must be enabled. Resources are explained in Resources. Once resources are enabled, there are two methods for storing the alternate sequence.

  • Automatic at index creation: If the file definitions are being stored using the Incremental File Structures, and the index has not been created, set altseq in the IIDX structure to point to the array of sorted integers. When the index is created, the alternate collating array is automatically stored in a resource record in the index file.
  • Manual after index created: If the file definitions are being stored using parameter files, or if the index is already created, use SetAlternateSequence() to store the alternate collating sequence as a resource in that file. Any key segment that is set to use an alternate sequence will use the one for that index file.

Regardless of using option 1 or option 2 to store the sorted integer array, segment mode 32 (ALTSEG) must be applied to the appropriate segment definitions.

Note: If you change the alternate collating sequence for an index file that already contains key values, you must rebuild the index or you will not be able to predict the sequence that the keys will appear.

GetAltSequence() brings the alternate collating sequence into memory for examination and update.