DELETE

Delete a record from an ISAM file

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
DELETE(channel) [[error_list]]

Arguments

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.

Discussion

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).

See also

I/O error lists.

Examples

.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