Deleting segments
When a segment is deleted in an HD database, it is physically removed from the database. The space it occupied can be reused when new segments are inserted.
As with the insertion of segments into an HD database, the various space management fields need to be updated.
- The bitmap needs to be updated if the block or CI from which the segment is deleted now contains enough space for a segment to be inserted. (Remember, the bitmap says whether enough space exists in the block or CI to hold a segment of the longest type defined. Thus, if the deleted segment did not free up enough space for the longest segment type defined, the bitmap is not changed.)
- The FSEAP needs to be updated to show where the first FSE in the block or CI is now located.
- When a segment is deleted, a new FSE might be created or the AL field value in the FSE that immediately precedes the deleted segment might need to be updated.
- If the deleted segment is a root segment in an HDAM or a PHDAM database, the value in its PTF pointer is put in the RAP or in the PTF pointer that pointed to it. This maintains the chain off the RAP and removes the deleted segment from the chain.
If a deleted segment is next to an already available area of space, the two areas are combined into one unless they are created by an online task that has not yet reached a sync point.