Problem:
How do I define "Sparse keys"?
Resolution:
Sparse Keys
A sparse key is an alternate key for which index entries are not created when the key has a particular value. For example, if an alternate key containg all spaces is defined as a sparse key, index entries for the key are not created when the alternate key contains only space characters.
Using this feature results in smaller index files. The larger your key(s) and the more records you have for which the alternate key has the given value, the larger your saving of disk space.
To enable sparse keys, use SUPPRESS WHEN ALL in the ALTERNATE RECORD KEY clause in the SELECT clause:
file-control.
select idxfile assign to "idx.dat"
organization is indexed
record key is idxfile-record-key
alternate record key is idxfile-alt-key
with duplicates
suppress when all "A".
In this example, if a record is written for which the value of the alternate key is all A's, the actual key value is not stored in the index file.
