The DELETE statement deletes records from relative and indexed files. It takes one of the following forms:
DELETE ([UNIT=]u [,ERR=s] [,IOSTAT=ios])
DELETE ([UNIT=]u [,REC=r] [,ERR=s] [,IOSTAT=ios])
For indexed files, DELETE deletes the current record, which is the last record that is accessed by a READ statement on the specified logical unit.
For relative files, DELETE deletes the direct access record specified by r, or the current record if REC=r is omitted. 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.
In the following example, the fifth record in the file connected to logical unit 10 is deleted from the file:
DELETE (10,REC=5)
In the next example, the current record is deleted from the file connected to logical unit 11:
DELETE (11)
For details on an alternative form for DELETE with relative files, see Section A.12.