DELETE Statement

Removes records, groups, or items from an existing access descriptor.

Type: Optional statement
Applies to: access descriptor
Interaction: UPDATE statement

Syntax

DELETE | DEL numeric-list;
DELETE | DEL item-name <... item-name-n> ;

Optional Arguments

numeric-list

is a list of index numbers, separated by logical operators, that represent the item's place in the access descriptor. You can obtain the index number of an item using the LIST statement described later in this section.

item-name

is the name of the IMS group, record, or item to be deleted. This field can also contain a quoted string.

Details

The DELETE statement deletes the specified record, group, or item from an access descriptor. You can specify as many records, groups, or items as you want in one DELETE statement. When you delete a group or record, all of the items in that group or record are deleted as well.
Note that if the first record of a descriptor is deleted, then the first item in the descriptor must still be a RECORD.
You can mix item names and quoted strings in the same DELETE statement, but you cannot mix index numbers and names. Referencing a list of index numbers is an efficient way to delete items like OCCURS clauses, which by definition are not unique.
The following are examples of DELETE statements:
DELETE 15 2 8 TO 12;       /* deletes a numeric list */
DELETE 1 TO 23 BY 2;       /* deletes a numeric list */
DELETE CITY STATE ZIP;     /* deletes by name        */
DELETE CITY 'FIRST-ORDER-DATE'; /* deletes a name and quoted string */