Updating the space management fields when a root segment is inserted
When a root segment is inserted into an HD database, the space management fields need to be updated.
The following figure illustrates this process. The figure makes several assumptions so real values could be put in the space management fields. These assumptions are:
- The database is HDAM or PHDAM (and therefore has a root addressable area).
- VSAM is the access method; therefore there are CIs (not blocks) in the database. Because VSAM is used, each logical record has 7 bytes of control information.
- Logical records are 512 bytes long.
- One RAP exists in each CI.
- The root segment to be inserted (SKILL1) is 32 bytes long.
The before
picture shows the CI containing the bitmap (in
VSAM, the bitmap is always in the second CI in the database). The
second bit in the bitmap is set to 1, which says there is free space
in the next CI. In the next CI (CI #3):
- The FSEAP says there is an FSE (which describes an area of free space) 8 bytes from the beginning of this CI.
- The anchor point area (which has one RAP in this case) contains zeros because no root segments are currently stored in this CI.
- The FSE AL field says there is 497 bytes of free space available starting at the beginning of this FSE.
The SKILL1 root segment to be inserted is only 32 bytes long; therefore CI #3 has plenty of space to store SKILL1.
The after
picture shows how the space management fields
in CI #3 are updated when SKILL1 is inserted.
- The FSEAP now says there is an FSE 40 bytes from the beginning of this CI.
- The RAP points to SKILL1. The pointer value in the RAP is derived
using the following formula:
Pointer value = (CI size)*(CI number - 1) + Offset within the CI to the root segment
In this case, the pointer value is 1032 (pointer value = 512 x 2 + 8).
- The FSE has been
moved
to the beginning of the remaining area of free space. The FSE AL field says there is 465 bytes (497 - 32) of free space available, starting at the beginning of this FSE.
