tcl.create-index

Verb: Access/TCL, Releases: AP

Creates new b-tree index.

Syntax

create-index file.reference a.code {(options)} create-index file.reference * {(options)}

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.

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).

Example

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
Ia23
Ia27:6

Next, the command is issued:

create-index entity *

Afterwards, the correlative attribute contains the 'root fid' for
each of the indexes.

See Also

Command Name Type Description
tcl.nframe-index Verb: Access Displays total number of frames used by index or indices.
cruising Definition Searches local and/or remote indexes.
b-tree Definition Balanced-tree index.
up.y Command In data-entry mode, searches backward on a remote index or moves cursor backward one word in text-entry mode.
pc.index.local Processing Code Defines local b-tree index.
basic.root Statement Loads the root.variable with the root FID of the specified index.
tcl.clear-index Verb: Access Clears all but null root of specified b-tree index.
tcl.indexer Verb: Access Creates b-tree indices for account.
pc.index.fdi Processing Code Maintains the root.fid of the index.
tcl.verify-index Verb: Access Verifies b-tree indices.
pc.a Processing Code Defines algebraic processing expression.
tcl.delete-index Verb: Access Deletes b-tree index.
basic.begin.work Statement Starts a transaction

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.