Accessing keyed filesΒΆ

records in a keyed file fall into two basic groups: those which read the key and data record, and those which read the key only.


  1. Commands which read the key and data records

    These commands, if successful, access both the key and the data values for the selected record. The data values from the selected record are read into a record buffer maintained by Sculptor. If the file is open in update mode, the record is locked. A record can only be updated and written back to the file if it is locked. While it is locked, other users are unable to lock or to update the record.

    An index-only file, created without a data file, cannot be locked, and therefore should not be used as the primary data file. It can safely be used as a secondary index.

    The [u] versions of the commands (findu, matchu etc.) are provided so that locking may be suppressed. With these commands, the record is not locked, even if the file is open in update mode. It can therefore not be amended or written back to the file. A record locked by another user may be read with a [u] command, but again cannot be amended or written back.

    It is good practice to use the [u] versions of the file access commands whenever searching or viewing a Sculptor keyed file, and to use the versions that lock the record only when a record is to be amended or deleted. This ensures that users who merely wish to view a record are not locked out.

    The [u] versions have the further advantage that they will succeed even if the record is locked by another user.

    find[u]

    Find and read a record by full or partial key value

    match[u]

    Read the next record matching the data provided for the last find operation

    next[u]

    Read the next record in a file

    prev[u]

    Read the previous record in a file

    read[u]

    Read a record from a file using exact key data


  1. Commands which read the key only

    These commands do not access the data file at all. Data from the file is not read into the record buffer, and it is not possible to select a record for update by means of these commands. They are useful for the purposes of simply testing if a particular key value exists, without the risk of causing or suffering from a locked record situation.

    nextkey

    Read key data only from next record in a file

    prevkey

    Read key data only from previous record in a file

    readkey

    Read key data only from record exactly matching supplied key

    testkey

    Test for a record with a specified key, without altering the file position


RELATED TOPICS

Keyed files

Updating keyed files