tcl.create-index Verb: Access/TCL


Command tcl.create-index Verb: Access/TCL
Applicable release versions: AP
Category TCL (746)
Description creates a new "b-tree" index in the specified file using the "a" processing code expression provided.

An "a" processing code or an "*" (asterisk) must be specified.

"a.code" specifies the "a (algebraic)" processing code to be used in forming the keys to the index. The processing code must include an attribute number immediately after the "a." The first attribute number in the processing code is the "master" attribute. This attribute determines the numer of values that an index key will generate.

The "*" (asterisk) designates all indices. This may be used as an alternate to a series of "create-index" commands by placing the "i" processing codes directly into the file-defining item ("d-pointer"), then using the "*" with the "create-index".

Once an index has been created, any changes made to the file through any process which updates the file are automatically reflected in the index.

An existing index may be overwritten using the "o" option.

The pointer to the index is placed in the "correlative" attribute of the file-defining item (attribute 8) as an "i" processing code. The number following the "i" indicates the "root" fid of the index. This should never be manually altered.
Syntax create-index file.reference a.code {(options)}
create-index file.reference * {(options)}
Options s Suppress the display of the running count of items.

o Overwrites existing indices.

l On releases 6.1.0 and higher, create-index will lock only the index nodes on which it is currently working to facilitate parallel access by other users. The "L" option will force create-index to lock the entire file during index creation (This was the default on pre-6.1.0 releases).
create-index entity a1

This creates an index on the contents of attribute 1.

create-index invoices a3(tcustomer.file;x;;1)

This creates an index on the results returned from attribute 3 of invoices, 
translated to customer.file, and returning attribute 3 from the item, if found.

create-index sales a1:3

This creates an index on attribute 1 concatenated with attribute 3.

This example illustrates how a series of indexes could be built:

First, the index references are placed in the correlative attribute (8) of the 
(entity) files d-pointer, so it looks something like this:

correlative      Ia1

Next, the command is issued:

create-index entity *

Afterwards, the correlative attribute contains the "root fid" for 
each of the indexes.
Related tcl.nframe-index