Previous Topic: Record DeletionNext Topic: Logical Deletion


Physical Deletion

Operations Performed

CA IDMS/DB performs the following operations to physically delete a record:

  1. Removes the record's data and prefix from the database.
  2. Moves all records following the deleted record on the page, so that all free space remains in the middle of the page.
  3. Performs the following operations, depending on the location of the record's line index on the page:
  4. Updates the space available count in the header.

Example

In this example, the first EMPOSITION record for EMPLOYEE 23 has prior pointers. In erasing the record, CA IDMS/DB removes the record completely (data and prefix), shifts the remaining EMPOSITION record up on the page, and sets the line index for the deleted record to zeros. The remaining EMPOSITION record, although now physically the second record on the page, remains as line number 3. Line index 2 is reused when a new record is added to the page.

Use of Record's Line Index

Line indexes cannot be shifted down because the position of the line index relative to other line indexes determines the line number, and changing a record's line number would invalidate the record's database key. Existing line indexes for physically deleted records are either reused as new records are added to the page (as shown in the previous diagram or removed as further deletions make them contiguous to the free space.