S Search and Delete the Records/Strings found

S ...=D [ I | P | PI | S | SI ] [, Q]

S .... represents a single/multiple search argument as described in the previous section "Search for Character Strings (Simple/Multiple Search Argument)".

If the string is found in a record, then the following delete operations are possible:

D Delete the entire record.

DI Delete the string. The record will be appropriately shortened.

DP Delete from the end of the ISAM key to the beginning of the string (Prefix).

DPI Delete from the end of the ISAM key to the end of the string (Prefix + Item).

DS Delete from the end of the string to the end of the record. (Suffix).

DSI Delete form the beginning of the string to the end of the record. (Suffix + Item).

Q Query: For each search item found, the user will be asked if the delete operation should be carried out. Pressing the DUE1 (ENTER) key will confirm the proposed deletion, and the search process will continue at the record containing the next search hit. Pressing the K3 key will cancel the proposed deletion, and move to the record containing the next search hit. The search will be terminated if the proposed S command in the command line is overwritten.

Standard: no Query mode. The deletions will be carried out without seeking confirmation from the user.

Note:

This variation of the Search command may only be executed in Modify mode (Action Code/command M) and on ISAM files. SAM files must first have been converted to an ISAM format.

Examples:

S,:1:>'0100'+:1:<'0500'=D

Prerequisite is an ISAM file with Recform=V,Keypos=5,Keylen=8. Beginning at the first record currently displayed, all records having an ISAM key greater than 0100 and less than 0500 are deleted.

S,:10-12:'1',:10-12:'2',:10-12:'3'=D,Q

The user is asked to confirm the deletion of any record containing the digits 1, 2 or 3 in columns 10 to 12 (Query mode, parameter Q). Pressing the DUE1 (ENTER) key will delete the displayed record, and then the next occurrence is sought. Pressing the K3 key will cancel the delete operation, and also search for the next occurrence.