Previous Topic: DISCONNECTNext Topic: Overview of FIND/OBTAIN


ERASE

Purpose

Deletes a record from the database.

Syntax

►►─── ERASE record-name ────┬──────────────────────────┬──────────────────────►
                            └┬─ PERMANENT ─┬─ MEMBERS ─┘
                             ├─ SELECTIVE ─┤
                             └─ ALL ───────┘

 ►───────┬────────────────────┬───────── . ───────────────────────────────────►◄
         └─ error-expression ─┘

Parameters

record-name

Erases the current occurrence of the named record from the database.

Record-name must be known to the dialog's subschema and must be current of run unit.

Note: Native VSAM users—ERASE record-name is the only form of the ERASE statement valid for records in a native VSAM KSDS or RRDS; no form of the ERASE statement is allowed for a native VSAM ESDS.

PERMANENT

Specifies the named record and all mandatory member record occurrences owned by the record to be erased. Optional member records are disconnected.

An erased mandatory member record that is itself the owner of any set occurrences is also treated as the direct object of an ERASE PERMANENT command (that is, all mandatory members in the sets owned by the record are also erased).

SELECTIVE

Specifies the named record and all mandatory member record occurrences owned by the record to be erased. Optional member records are erased if they do not currently participate as members in other set occurrences.

An erased member record that is itself the owner of any set occurrences is also treated as the direct object of an ERASE SELECTIVE command.

ALL

Specifies the named record, all mandatory and optional member record occurrences owned by the record to be erased.

An erased member record that is itself the owner of any set occurrences is also treated as the direct object of an ERASE ALL command.

MEMBERS

Must be specified if the record identified by record-name is the owner of any nonempty set occurrences.

error-expression

Specifies the status codes that are returned to the dialog.

Usage

Definition

Erasure is a two-step process that first cancels a record's membership in any set occurrences and then releases for reuse the space occupied by the record.

The ERASE command performs the following functions:

Considerations

If autostatus is not in use, a dialog's error-status field indicates the outcome of an ERASE command:

Status code

Meaning

0000

The request was executed successfully

0206

Currency was not established for the object record

0209

The object record's area was not readied in an update usage mode

0210

The dialog's subschema specifies an access restriction that prohibits use of the ERASE command.

0213

Run-unit currency was not established or was nullified by a previous ERASE command

0220

The current record of run unit is not the same type as the specified record

0221

An area other than the area of the object record was readied with an incorrect usage mode

0225

Currency was not established for the object record or set

0229

A run-unit deadlock condition occurred. DBMS aborted and rolled back the run unit. All resources associated with the task are released

0230

An attempt was made to erase the owner of a nonempty set

0233

Erasure of the object record is not allowed by the dialog's subschema, or not all sets in which the object record participates are included in the subschema

Further Considerations

More information:

Error Handling

READY