Opens an index.
OPENINDEX filename,indexname TO ivar [THEN statements] [ELSE statements]
argument accepts a single dynamic array reference (A<i>), a single substring reference (A[s,l]), or a substring reference nested inside a dynamic array reference (A<i>[s,l]).
You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the index is opened, the THEN clause is executed. If the index cannot be opened, the ELSE clause is executed. The statements
argument can be the NULL
keyword, a single statement, or a block of statements terminated by the END
keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.
The following example used OPENINDEX
to open an index to VOC on the attribute F1. The SELECT
selects this index to a select list. The READNEXT KEY
reads an item from the select list:
OPENINDEX 'VOC','F1' TO IdxFp ELSE ABORT
SELECT IdxFp TO IdxList
READNEXT KEY Idx,Id FROM IdxList