DELETE (FILE)
The DELETE instruction removes records from a text file. The statement format is as follows:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
file
Required. A previously defined and opened FILE variable from which the data is removed.
record
Optional. A previously defined Numeric Variable, Numeric Literal, or Expression that specifies the record.
Flags Affected: OVER
Note the following:
If {file} is not declared as having fixed length records, an I/O error occurs.
The optional {record} parameter specifies the record number. If {record} is not specified, the current record (if set) is deleted.
If the {record} variable is not specified and the current file position is invalid, an I/O error occurs.
If {record} is a numeric variable and it is less than zero (0), an I/O error occurs.
If {record} is an arithmetic expression, the expression is evaluated and the result is used. If the result is less than zero, an I/O error occurs.
If {record} is not specified, the record at the current file position is removed and the current file position remains unchanged.
The OVER flag is always cleared.
If {record} is specified and the record is successfully located, it is removed. The current file position is set to the position of the deleted record.
If the record has already been deleted, no I/O error occurs.
When using the single unlocking mode, a DELETE to a locked record unlocks the record when the operation completes.
See Also: Example Code, WRITE (FILE), Disk I/O Instructions
![]() |