Removing Records

The REMOVE command will remove a record in any of the keyed files. The general syntax of the REMOVE is:

>REMOVE (chan,KEY="AAA")

If the REMOVE cannot find the record specified by the KEY= option, it will leave the file pointer where it was and issue !ERROR=11. As in READ, the DOM= option is usually used to trap the error and proceed with exception processing. After the record is removed, the pointer is placed to the key logically following the removed key.

In an MKEYED file the key specified must be from the primary key chain. If the key exists, PRO/5 will read the data record and remove all of the alternate keys.

Removed records in DIRECT files are filled with all $00$ (null) characters. This allows reconstruction of damaged files (i.e., caused by power failures, etc.) by accessing the file by IND= and writing the retrieved records to a new DIRECT file. Removed records in MKEYED files have the first 4 bytes replaced with a pointer to the next removed record in the MKEYED file.