Technical data

ERASE
ERASE
Function
The ERASE statement deletes the current record of the run unit from the
database. Additional records owned by the current record may also be deleted
and/or disconnected.
General Format
ERASE
ALL
record-name
ON ERROR stment
NOT
ON ERROR stment2
END-ERASE
record-name
names a subschema record type.
stment
is an imperative statement executed for an on error condition.
stment2
is an imperative statement executed for a not on error condition.
General Rules
1. The ERASE statement references the current record of the run unit.
2. Use record-name to check that the current record of the run unit has the
same record type as record-name.
3. The current record of the run unit must be in a realm in update ready mode,
and all records required by the Database Control System (DBCS) to execute
the ERASE statement must be in a realm in available mode.
4. The current record of the run unit is called the object record for the remaining
General Rules.
5. The object record is erased from all sets in which it is a member and deleted
from the database.
6. If you use the ALL phrase, the object record and all sets owned by the object
record are erased (independent of set membership retention class).
7. If you do not use the ALL phrase, these rules apply to the members of the
sets owned by the erased object record:
Each member with FIXED membership is erased.
Each member with OPTIONAL membership is disconnected from the set
but not deleted from the database.
An exception occurs if any members have MANDATORY membership.
8. The database key value corresponding to the erased object record is removed
from all keeplists.
9. General Rules 5 to 8 apply to each erased record as if it were the object
record.
4–28 Procedure Division