DELETE Statement

The DELETE statement deletes an item from a file.

Format

DELETE [filevar ,] item-ID

Parameter(s)

filevar

Variable to which the file was opened. If filevar is not specified, the default file variable is used, which is the file most recently opened without a file variable assignment.

item-ID

Expression evaluating to the item-ID of the item to be deleted.

Description

The DELETE statement deletes the specified item from a file and releases item locks. The file must have been opened with the OPEN statement before it may be deleted.

If the file item is not found, no action is taken.

Example

In this application the INVENTORY file for a shoe store contains information about each shoe sold. The style number is used as the item-ID for each shoe. When a shoe has been discontinued, the DELETE statement is used to delete the record from the INVENTORY file.

PRINT "ENTER DISCONTINUED STYLE NUMBER : " :

INPUT STYLE.NO

DELETE INVENTORY , STYLE.NO

See Also

Statement and Function Reference