Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

OPENINDEX

Description

The OPENINDEX statement is used to open a particular index definition for a particular file. This index file variable can later be used with the SELECT statement. It takes the general form: 

OPENINDEX filename,indexname TO indexvar {SETTING setvar} THEN|ELSE statements

Where:

  • filename should correspond to a valid file which has at least one index, 
  • indexname should correspond to an index created for the filename,
  • indexvar is the variable that holds the descriptor for the index.

If the OPEN statement fails it will execute any statements associated with an ELSE clause. If the OPEN is successful it will execute any statements associated with a THEN clause. Note that the syntax requires either one or both of the THEN and ELSE clauses.

If the SETTING clause is specified and the open fails, setvar will be set to one of the following values: 

Code
Description
128
No such file or directory
4096
Network error
24576
Permission denied
32768
Physical I/O error or unknown error


An example of use is as:

OPENINDEX "CUSTOMER","IXLASTNAME" TO custlastname.ix SETTING errval ELSE
    CRT "OPENINDEX failed for file CUSTOMER, index IXLASTNAME"
    ABORT
END


Go back to jBASE BASIC

Was this article helpful?