Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

DELETE

Statement: Deletes a record from a relative file.

DELETE ([UNIT=] io-unit[, REC=r][, ERR=label] [, IOSTAT=i-var])

io-unit

Is an external unit specifier.

r

Is a scalar numeric expression indicating the record number to be deleted.

label

Is the label of the branch target statement that receives control if an error occurs.

i-var

Is a scalar integer variable that is defined as a positive integer if an error occurs and zero if no error occurs.

In a relative file, 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 at that position.

NOTE:

You must use compiler option vms for READs to detect that a record has been deleted.

Example

The following statement deletes the fifth record in the file connected to I/O unit 10:

  DELETE (10, REC=5)

Suppose the following statement is specified:

  DELETE (UNIT=9, REC=10, IOSTAT=IOS, ERR=20)

The tenth record in the file connected to unit 9 is deleted. If an error occurs, control is transferred to the statement labeled 20, and a positive integer is stored in the variable IOS.