basic.root Statement/BASIC Program

basic.root

Command basic.root Statement/BASIC Program
Applicable release versions: AP
Category BASIC Program (486)
Description provides an interface to the b-tree indexes for subsequent references with the "key" statement.

This is somewhat like an "open", in that the statement establishes the root fid of the given index and assigns it to the "root.variable". Subsequent use of the "key" statement references the corresponding "root.variable". Any number of indexes may be "open" at once, provided that each has a unique "root.variable".
The "a.code" is a string expression containing the "a" (algebraic) processing code located in the file-defining item which identifies the index to use. The index must have previously been created with "create-index".

"root.variable" is for use by subsequent "key" statements.

The optional "then" clause is executed if the specified index is found. The "else" clause is executed if it is not found.

The "key" statement, in conjunction with the initializing "root" statement, provides the ability to sequentially cruise on any defined index for a particular file.

The "root" statement must precede the "key" statement.

See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them.
Syntax root file.reference,a.code to root.variable {then | else statement.block}
Options
Example
See "key".
Purpose
Related basic.statements
basic.then/else.construct
tcl.clear-index
tcl.create-index
statement.block
b-tree
pc.a
file.reference
basic.key