Skip to content

REMOVE

Remove Record from File

This directive is used to remove a key from a SORT file or a key and data from a DIRECT file. The record pointer is advanced to indicate the next sequential record.

REMOVE (channel, KEY=string-value [,I/O-opts])
channel
is an integer in the range of 0 to 32764 indicating the channel of an OPEN file. If omitted, 0 is the default.
string-value
is any string, which represents the key value of the record to be removed.
I/O-opts
is one or more of the following specifiers:
DOM=line-ref
ERR=line-ref
ERC=error-code

I/O options include:

DOM=
specifies the program line number or label to branch to if an attempt is made to access a record and no such key value is found (ERR=11). DOM= takes precedence over ERR= in the same REMOVE directive.
ERR=
specifies the program line number or label to branch to if an error is produced by this directive.
ERC=
specifies a programmer-defined error code, which enables programmers to define and manage errors without branching. ERC= provides a structured programming alternative to ERR=.

The KEY= option may be omitted to REMOVE a currently EXTRACTed record.

REMOVE (5, KEY = "A245")

deletes the record from the file that is OPEN on channel 5 that is indicated by the key value “A245”.

REMOVE (5, KEY = K$, DOM = 5000, ERR = 7999)

If K$ = “A245”, has the same effect as the first example and branches to statement 5000 if a missing key condition exists or to statement 7999 if any other error condition occurs.

EXTRACT, READ, and WRITE directives

From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF