MAKE.INDEX |
![]() ![]() ![]() |
The MAKE.INDEX command creates and builds an alternate key index. It is equivalent to use of CREATE.INDEX followed by BUILD.INDEX.
Format
MAKE.INDEX filename field(s) {NO.NULLS} {PATHNAME index.path}
where
The MAKE.INDEX command creates the file structures to hold an alternate key index and then builds the index.
The field(s) referenced in the command must correspond to D, I, A, S or C-type dictionary items. The dictionary items can be deleted once the index has been constructed as all details of the indexed field are stored in the index file but this is not recommended. The value to be indexed must not exceed 255 characters. Values longer than this will not be included in the index.
Indices constructed on I or C-type dictionary items or on A or S-type items that use correlative expressions should be such that they always produce the same result when executed for the same data record. Examples of possibly invalid I-type expressions would be those that use the date or time and those that use the TRANS() function to access other files.
The NO.NULLS specifies that no entry is to be added to the index for records where the indexed field is null.
Normally, the indices are stored as subfiles in the directory that represents the data file. The PATHNAME option allows the indices to be stored in an alternative location. This might be useful, for example, to balance loads across multiple disks or to exclude indices from backups as they can always be recreated.
All indices for a single data file must be stored together. The PATHNAME option can be used when creating the first index and specifies the pathname of a new directory that will be created at the same time as the index. If this option is included when creating subsequent indices the index.path must be the same as for the first index. It is suggested that the pathname should be based on the data file name for ease of recognition.
Index subfiles can be moved using the operating system level qmidx program.
The MAKE.INDEX command requires exclusive access to the file during the build phase.
Data Encryption
Alternate key indices may be applied to files that use record level data encryption but developers should be aware that the index itself is not encrypted and hence weakens the security of the indexed fields.
Files using field level encryption cannot have indices on encrypted fields. Also, indices constructed from calculated values such as I-types that use encrypted fields will fail if the record is updated by a user that does not have access to the relevant encryption key.
Example
MAKE.INDEX ORDERS DATE
The above command creates and builds an index on the DATE field of the ORDERS file.
See also: BUILD.INDEX, CREATE.INDEX, DELETE.INDEX, LIST.INDEX, MAKE.INDEX |