DELETE
The DELETE command deletes specified data records and all key index structure
associated with those records.
Syntax:
DELETE/options
collection [tablename]
Notation standards Options Answers
Options:
X -Suppress
the command response
Y -Do
not alter the command answer cells
Answers:
Ctl.Ans1 -Number
of records deleted
Ctl.Ans2 -Zero
Ctl.Ans3 -Zero
Notes:
The subset you isolate determines the records to be deleted.
Suppose you want to delete all the SALES records for the year 1980.
FIND
A SALES WHERE YR=80
DELETE
A SALES
In this example, you isolate specific records from the SALES table into
collection A and then delete them.
But now suppose you want to delete all records for customers number AX0021.
This customer number appears in more than one table.
FIND
A WHERE CUST# = AX0021
DELETE
A
In this case, you isolate all occurrences of CUST# AX0021 (that is, from all
tables in the data base in which it occurs) into collection A, and then delete
them. Observe that the first DELETE example is table specific. The second
example is global.
Be very careful when you are doing global deletes. Be sure you know the status
of each tables portion of the collection, because all isolated records in all
portions of the collection are going to be deleted when the delete is global,
that is, when it is not table specific. If you mean to be deleting records from
just one table, it is always safest to be specific in the DELETE command, and
mention that table name. For an example of what not to do, consider the
following sequence:
FIND
A SALES WHERE YR=80 DO
NOT DO THIS
DELETE
A DO
NOT DO THIS
DO NOT DO THIS! Because the collection was not CLEARed at the beginning of this
sequence, and the FIND was table specific, you do not know the status of the
other portions of this collection. The DELETE is not specific, so it will
delete everything it finds in all portions of collection A. This could be
disaster.
It was correct to do a global DELETE in the example above that involved the
CUST#, because in that example the query was global (the FIND did not mention a
table name) so the status of the entire collection is known. Only the records
you want to delete are found, and any table's portion where the set selection
criterion CUST# = AX0021 is not true is set to zero.
Don't confuse DELETE with ERASE, which is used to erase files by referring to
their file names.
Copyright © 2019 , WhamTech, Inc. All rights reserved. This
document is provided for information purposes only and the contents hereof are
subject to change without notice. Names may be
trademarks of their respective owners.