Deletes data entries from a data set.
Discussion |
 |
This command is an extension of a retrieval command in that it deletes
those entries selected by the previous retrieval command. All of the entries
must reside in the same data set. UPDATE DELETE may only be used
following the FIND or FIND ALL command or SUBSET command following a FIND
or FIND ALL command. Entering FIND CHAIN or MULTIFIND (selecting entries
from more than one data set) and then UPDATE DELETE is not allowed.
To delete entries from a data set, you must have write access to the data
set, as determined by the password you enter in response to the
PASSWORD= prompt or through the PASSWORD= command.
When you enter an UPDATE DELETE command, QUERY prints the message:
DELETE ALL RETRIEVED ENTRIES (YES OR NO)?
|
This message is reminder that all the entries selected by the last retrieval
command will be deleted by the command. If you respond YES, QUERY deletes
the entries. If you respond NO, the command is ignored and you are
prompted for another command. In job mode, the entries are deleted without
confirmation.
In a procedure, you must use the UPDATE DELETE form of the command. UPDATE
may be abbreviated. DELETE may not be abbreviated when using it with the
UPDATE keyword.
You must have specified a mode of 1, 3, or 4 in order to use this command.
Master Data Entries |
 |
QUERY disallows any attempt to delete the master entry if its
search item value still exists in the search items of the appropriately
linked detail data sets. However, QUERY will continue to delete as
many entries as it can. When all possible entries have been deleted,
QUERY will issue a message indicating how many master entries with
associated details were encountered, and how many entries were
able to be successfully deleted.
>F CUSTOMER.ACCOUNT IS 07954001
1 ENTRIES QUALIFIED
>U DELETE
DELETE ALL RETRIEVED ENTRIES (YES OR NO)?
>>YES
1 ENTRIES NOT DELETED BECAUSE CORRESPONDING DETAIL DATA ENTRIES EXIST
0 OF 1 QUALIFYING ENTRIES DELETED
>FIND SALES.ACCOUNT IS 07954001
1 ENTRIES QUALIFIED
>DEL
DELETE ALL RETRIEVED ENTRIES (YES OR NO) ?
>>YES
>
|
In this example, there is a detail data entry in SALES with an
ACCOUNT value of 07954001, so QUERY will not delete the entry from
the CUSTOMER master data set.
Next, an entry with an ACCOUNT equal to 07954001 is deleted from
the SALES detail data set. Now the ACCOUNT equal to 07954001
in the CUSTOMER master data set can be deleted.