Updating keyed files

A keyed file may be updated in three ways: by inserting a new record, by amending an existing record, and by deleting an existing record. The relevant commands are:

delete

Delete a record from a file.

insert

Insert a new record into a file.

write[kl]

Write a record back to a file.

The file must be open in update or create mode. The delete and write[kl] commands also require that a locked (selected) record be read into the record buffer. A record is automatically selected when it is read, provided that the file is open in create or update mode and that the [u] version of the file access command was not used.

These commands automatically update all the file’s secondary indexes. This causes all the indexes to be positioned at the key value of the updated record.


RELATED TOPICS

Keyed files

Accessing keyed files

File position

Secondary indexes