The DELETE statement deletes a record from a relative or indexed organization file. It takes one of the following forms:
Rules and Behavior
In files with keyed access, the DELETE statement deletes the current record. The current record is the last record that is accessed by a READ statement on the specified external unit.
In files with direct access, the DELETE statement deletes the direct access record specified by r. If REC=r is omitted, the current record is deleted. When the direct access record is deleted, any associated variable is set to the next record number.
The DELETE statement logically removes the appropriate record from the specified file by locating the record and marking it as a deleted record. It then frees the position formerly occupied by the deleted record so that a new record can be written into that position.
The following statement deletes the fifth record in the file connected to I/O unit 10:
In the next example, the current record is deleted from the file connected to I/O unit 11:
DELETE (10, REC=5)
For More Information: