Technical data
ERASE
10. The successful ERASE statement changes currency indicators as follows:
• The currency indicator for the current record of the run unit points to the
position in the database vacated by the current record of the run unit.
However, you no longer have a current record.
• If an erased record is the current record of a disconnected set type, that
set type currency indicator now points to the position in the set vacated
by that record.
• If an erased record is the owner of the current set of any set type, that set
type’s currency indicator becomes null.
• If an erased record is the current record of a record type, that record type
currency indicator becomes null.
• If the erased record is the current record of the realm, that realm currency
indicator now points to the position in the realm vacated by that record.
11. If the execution of an ERASE statement results in a database exception
condition, no changes are made to the database.
12. If a database exception condition occurs during the execution of an ERASE
statement, the DBCS places a database exception condition code in the
special register DB-CONDITION (see Technical Notes). This code identifies
the condition.
Technical Notes
ERASE statement execution can result in these DB-CONDITION database
exception condition codes:
DBM$_CRUN_NULL The currency indicator for the run unit is null.
DBM$_CRUN_POS The currency indicator for the run unit specifies the
position of a vacated record in the record collection.
DBM$_WRONGRTYP The record type of record-name is not the same as the
current record’s type.
DBM$_ERASEMANDT You attempted to erase a record that is the owner of
a set occurrence with a MANDATORY member record
occurrence, but you did not use the ALL option.
DBM$_NOT_UPDATE A realm is not in update usage mode.
Additional References
• Section 2.2, on reserved words (database special registers)
• HP COBOL Reference Manual, Chapter 6, section on scope of statements
• Section 4.8.1, on database On Error condition
• USE statement
Examples
1. This example erases PART record, all records owned by PART in the PART_
USES, PART_INFO, and PART_USED_ON sets. It also erases all SUPPLY
and PR_QUOTE records that it owns through the PART_INFO set. It
disconnects PART from the RESPONSIBLE_FOR set.
ERASE PART.
Procedure Division 4–29