The create-index BASIC program creates a new B-tree index in the specified file using the a (algebraic) processing code expression provided and ensures the a0 index case-sensitivity matches the item-ID case sensitivity.
create-index file.reference a.code{(options)} create-index file.reference attribute.defining.item{(options)} create-index file.reference* {(options)}
a.code | Specifies the a processing code to be
used in forming the keys to the index. The processing code must include an attribute number immediately after the a and cannot contain any named attribute references. The first attribute number in the processing code is the master attribute. This attribute determines the number of values that an index key generates. Note:
Regarding the use of translates when creating indexes
For Hot Backup (Windows and UNIX): All indexes using translate correlatives should contain a fully-pathed file reference. This is necessary because the Hot Backup slave processes operate out of the DM or FSIDM accounts. For example: create-index file1 a1(tmainaccount,file2,;x;;1)) For Windows: Great caution should be taken when using translates during index creation since index corruption can occur. To employ translates, the file reference must contain the full path to the file. For example: create-index file1 a1(tfsidm,tfile2,;x;;1))For UNIX: Use the s (subindex) processing code to employ translates. |
|
specifier | * | Designates all indexes. This can be used as an alternate to a series of create-index commands by placing the i processing codes directly into the correlative position of file-defining item (D-pointer), and then using the asterisk with the create-index command. |
options | c | Specifies the keys are case sensitive. Default is case insensitive. If the
* specifier is used, the index(es) will remain case insensitive. As of D3 v9.0, you can create an index with a casing different than what is established by the TCL case command (defaults to off), but AQL will not use it unless the TCL case command setting matches the index casing. The BASIC root and key statements will use the specified index that matches the TCL case command setting, unless the BASIC casing statement is used to override it. |
f |
For Windows FSI only: Creates floating-point indexes (where the keys are
floating-point numbers, such as '1.234E123'. 2). Index keys might be normalized (plus signs and non-significant digits are removed, and decimal points are moved). For example: '+00123e12' is entered in the index as '123e12'. Tip: If the keys do not have exponents (for
example: '123.456'), use numeric indexes
instead.
|
|
l | Locks the file on which it is currently working to facilitate parallel access by
other users. The l option forces a create-index to lock the entire file during index creation. |
|
n | Creates numeric indexes. Numeric indexes are sorted according to their numerical value. For example: "10.5" is greater than "9.34" and "9 June 1980" is less than "1 Aug 2010" When searching for the first entry in the index, use the smallest expected negative number as the first search key. The empty string "" is considered to be 0. For example: s=-9999 i='' key('n',r,s,i) then... finds -9000, but does not find -10000.
Note: For numeric indexes to work properly in the vme, numeric data must be stored in
scaled internal format. That is, with no decimal or thousands separators {-}
n {n...}. This ensures correct behavior when accessing numeric
indexes.
|
|
o | Re-creates the index, overriding the previous version. | |
s | Suppresses the display of the running count of items. |
Example: a1(tcustomers;x;;3)
The index update code decides how many values are present based on the first attribute referenced in the f-correlative generated when the a-correlative is compiled.
The number following i indicates the root FID of the index in the VME. This should never be manually altered.
VME index keys have a maximum length of 249.
The number following i indicates the number of the index in the FSI. This should never be manually altered.
FSI index keys have no maximum length.
Example 1
Creates an index on the contents of attribute 1.
create-index entity a1
Example 2
create-index invoices a3(taccount,customer.file,;x;;1)
Example 3
create-index sales a1:3
Example 4
Illustrates how a series of indexes can be built:
correlative Ia1 Ia23
create-index entity *
Afterward, the correlative attribute contains the root FID for each of the indexes.