The ERASE statement performs the following functions:
ERASE is a two-step procedure that first cancels the existing membership of the named record in specific set occurrences and then releases for reuse the space occupied by the named record and its db-key. Erased records are unavailable for further processing by any DML statement.
Before executing the ERASE statement, satisfy the following conditions:
Include in the subschema all sets in which the specified record participates as owner either directly or indirectly (for example, as owner of a set with a member that is owner of another set) and all member record types in those sets.
Currency
Following successful execution of an ERASE statement, currency is nullified for all record types involved in the erase both explicitly and implicitly. Run unit and area currency remain unchanged. Next, prior, and owner currencies are preserved for sets from which the last record occurrence was erased. These currencies enable you to retrieve the next or prior records within the area or the next, prior, or owner records within the set in which the erased record participated. An attempt to retrieve erased records results in an error condition.
►►─── ERASE RECORD (record-name) ─┬─────────────┬─ ; ─────────────────────────►◄ ├─ PERMANENT ─┤ ├─ SELECTIVE ─┤ └─ ALL ───────┘
Names the record type to be erased. Record-name must be a record included in the subschema. The current of record-name must be current of run unit. Unless the PERMANENT, SELECTIVE, or ALL qualifier follows, an error condition results if the named record is the owner of any nonempty set occurrences.
Native VSAM users: ERASE RECORD (record-name) is the only form of the ERASE statement valid for records in a native VSAM key-sequenced data sets (KSDS) or relative-record data sets (RRDS); the ERASE statement is not valid for a native VSAM entry-sequenced data sets (ESDS).
Erases the specified record and all mandatory member record occurrences owned by the specified record. Optional member records are disconnected. If any of the erased mandatory members are themselves the owner of any set occurrences, the ERASE statement is executed on such records as if they were directly the object record of an ERASE PERMANENT statement (that is, all mandatory members of such sets are also erased). This process continues until all direct and indirect members have been processed.
Erases the specified record and all mandatory member record occurrences owned by the specified record. Optional member records are erased if they do not currently participate as members in other set occurrences. All erased member records that are themselves the owners of any set occurrences are treated as if they were the object of an ERASE SELECTIVE statement.
Erases the specified record and all mandatory and optional member record occurrences owned by the specified record. All erased member records that are themselves the owners of any set occurrences are treated as if they were the object record of an ERASE ALL statement.
The following four figures illustrate use of the three parameters of the ERASE statement. Note that the outcome of the ERASE statement varies based on the qualifier specified (PERMANENT, SELECTIVE, or ALL). Although all three qualifiers cause all mandatory members owned by the specified record to be erased, they differ in their effect on optional members.




The following figure shows the effect each of the parameters has on currency.

Upon completion of the ERASE function, the ERROR_STATUS field in the IDMS DB communications block indicates the outcome of the operation:
The request has been serviced successfully.
The object record is not in the specified subschema.
The named record's area has not been readied in one of the three update usage modes.
The subschema specifies an access restriction that prohibits use of the ERASE statement.
A current record of run unit has either not been established or has been nullified by a previous ERASE statement.
A db-key has been encountered that contains a longterm permanent lock.
The current record of run unit is not the same record type as the named record.
An area other than the area of the specified record has been readied with an incorrect usage mode.
Currency has not been established. Only OBTAIN statements update index set currencies.
A broken chain has been encountered in the process of executing an ERASE ALL, PERMANENT, or SELECTIVE.
An attempt has been made to erase the owner record of a nonempty set.
Either erasure of the record occurrence is not allowed in this subschema or all sets in which the record participates have not been included in the subschema.
A record occurrence has been encountered whose type is inconsistent with the set named in the ERROR_SET field of the IDMS DB communications block; probable causes are a broken chain or improper database description.
No record can be found for a pointer db-key. The probable cause is a broken chain.
|
Copyright © 2014 CA.
All rights reserved.
|
|