DELETE

Delete a record from an ISAM file

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
DELETE(channel) [[error_list]]

channel

The channel on which the ISAM file is open in update mode (U:I). (n)

error_list

(optional) An I/O error list. If any one of the specified errors occurs during the DELETE, control is transferred to the associated label.

The DELETE statement deletes the current record on the specified channel. This statement is used exclusively with ISAM files on Windows and Unix.

On OpenVMS, you can use DELETE to delete records from a relative file. You cannot use U:* if you want to delete records. You must open the file with an explicit submode (for example, U:I) to allow the DELETE to work.

You can use the DELETE statement only after a FIND, READ, or READS statement. The current record being deleted must be locked if the file can be accessed by other users; otherwise, you’ll get a “No current record” error ($ERR_NOCURR).

Tip

When deleting more than 10% of the data in a very large (greater than 100,000 records) multi-key ISAM file, you can improve performance when exclusive access is possible by writing out a sequential file of the data you want to save and using fconvert to reload and optimize the file. Note: If binary data is present (including RFAs or INTEGER, UNSIGNED, SEQUENCE, TIMESTAMP, and CTIMESTAMP keys), use a relative file instead of a sequential file. (For variable-length records with binary data present, see Synergy counted files.)

.define TTCHN           ,1
.define ISMCHN          ,2
record rec
    data1       ,a30
    key         ,a16
    data2       ,a25
record
    io          ,a20

proc
    open(TTCHN, o,"tt:")
    display(TTCHN, "ISAM file to examine:  ")
    reads(TTCHN, io, done)
    open(ISMCHN, u:i, io)
    repeat
      begin
        display(TTCHN, "Key:  ")
        reads(TTCHN, io, done)
        read(ISMCHN, rec, io)
        writes(TTCHN, "Data:  " + rec)
        display(TTCHN, "Delete this record?  ")
        reads(TTCHN, io, done)
        if (io .eq. 'Y')
          delete(ISMCHN)
      end
done,
    close ISMCHN
    stop
end