OPEN #channel, filespec, mode, recno, fstat {,end'file} {, wait'record} {,wait'file} {,read'only}
Opens the file. (Note that while internally there may be multiple physical files, from BASIC, the combination of the data file and index is treated as a single file. Unlike old ISAM, there is no need or possibility of opening up additional index files.)
channel
expression or variable evaluating to an integer, which will be used to identify all other operations on related to this open.
filespec
name of the file (without any extension).
mode
must be one of the following:
Open Mode |
Meaning |
INDEXED |
Normal shared open. If file is already open by another user exclusively, job will wait (if the wait'record option specified) or receive BASIC error 37 (file in use). |
INDEXED' |
Open for exclusive use. If file is already open by another user in any mode, job will wait (if the wait'record option specified) or receive BASIC error 37 (file in use). |
ISAMP' |
Same as INDEXED but forces operation to be interpreted as an ISAM-A open rather than an ISAM open, regardless of the COMPIL mode. Otherwise the COMPIL mode will determine whether to assume old ISAM or ISAM-A. |
ISAMP'INDEXED' |
Same as INDEXED'EXCLUSIVE but forces operation to be interpreted as an ISAM-A open rather than an ISAM open, regardless of the COMPIL mode. |
recno (floating point)
holds the current record number. Normally, you never need to do anything explicitly with this variable since all operations are based on the index, but it will be set to the data record number after each successful index operation, and is used as input to the record deletion and update operations.
fstat (floating point)
set to indicate the status of most operations, from the following table:
Symbol |
Value |
Meaning |
ISAM_NF |
-3 |
Not found |
ISAM_NA |
-2 |
Not available (record locked) |
ISAM_LT |
-1 |
Key found which is less than specified key |
ISAM_EQ |
0 |
Key found equal to specified key |
ISAM_OK |
0 |
OK |
ISAM_GT |
1 |
Key found greater than specified key |
ISAM_DK |
2 |
Duplicate key error in CREATE’RECORD (if AF_ISAMNODUPERRS set) |
The remaining parameters are all optional modifiers and may be specified in any order:
Open Modifier |
Meaning |
end'file |
Positions the internal index pointer at the end of the primary index, rather than at the beginning (so that a GET'PREV or FIND'PREV will return the last record in the index). |
wait'record |
If an attempt is made to read a locked record, the program will wait until the record is freed. |
wait'file |
Causes the OPEN operation to wait until the file is available (instead of returning error 37 if it is not). |
read'only |
Indicates that the file will only be accessed for read operations. Attempts to perform updates will fail with an error. |