The KEY instruction specifies the key structure for an indexed file. It is used when an output file is indexed and its key structure is not the same as that of the indexed input file.
The format of the KEY instruction is:
KEY ({start,length,ixkey},...)
where the parameters are:
You can repeat the KEY instruction as often as required to describe the entire key structure. Use commas to separate the parameters and parameter sets (start, length, ixkey).
You must define the keys in order of importance with the primary key first, followed by all its components if it is split, then the first alternate key and all of its components and so on.
The following example defines three keys:
KEY (4,5,p,10,5,c,20,2,ad,40,2,a,46,10,c)
where:
4,5,p,10,5,c | represents the first primary key which is split. Its first component starts at character position 4 with a length of 5 bytes and its second component starts at character position 10 with a length of 5 bytes. |
20,2,ad | represents the second (alternate) key which can have duplicates and starts at character position 20 with a length of 2 bytes |
40,2,a,46,10,c | represents the third key. This is a split alternate key, with the first component starting at character position 40 with a length of 2 bytes and the second component starting at character position 46 with a length of 10 bytes. |