OPENINDEX
Synopsis
OPENINDEX filename,indexname TO ivar [THEN statements] [ELSE statements]
Arguments
filename | The name of a MultiValue file defined in the VOC, or the name VOC. filename must be specified as a quoted string. If there are multiple defined data sections (data files), you can specify filename as "filename,datasection". |
indexname | The name of a defined index, specified as a quoted string. |
ivar | The name of an index variable, a dynamic array. |
Description
The OPENINDEX statement is used to open an existing index and create an ivar (index variable) for use by the SELECT, SELECT ATKEY, or SELECTINDEX statement.
The ivar 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.
Examples
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
See Also
-
SELECT statement
-
SELECT ATKEY statement
-
SELECTINDEX statement
-
READNEXT statement
-
READNEXT KEY statement