Example of Sparse Key Definition

To define a sparse key:

 file control.
     select fd_name
         assign to "user.dat"
         organization is indexed
         record key is fd-name-key
         alternate record key is fd-name-alt-key 
          with duplicates 
          suppress when all "A".
 fd fd-name.
 01 fd-name-record.
     03 fd-name-key  pic X(3).

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.