General format of HD databases and use of special fields
The way in which an HD database is organized is not particularly complex, but some of the special fields in the database used for things like managing space make HD databases seem quite different from sequentially organized databases.
The databases referred to here are the HDAM or PHDAM and the HIDAM or PHIDAM databases. HIDAM and PHIDAM each have an additional database, the primary index database, for which you must allocate a data set. For HIDAM databases, the primary index database must be defined with its own set of statements. For PHIDAM databases, the primary index database does not need to be defined by its own set of statements. For both, IMS maintains the index. This topic examines the index database when dealing with the storage of HIDAM records. The following figure shows the general format of an HD database and some of the special fields used in it.

HD databases use a single data set, that is either a VSAM ESDS or an OSAM data set. The data set contains one or more CIs (VSAM ESDS) or blocks (OSAM). Database records in the data set are in unblocked format. Logical record length is the same as the block size when OSAM is used. When VSAM is used, logical record length is slightly less than CI size. (VSAM requires some extra control information in the CI.)
You can either specify logical record length yourself or accept the IMS defaults. IMS generates logical record lengths equal to a quarter, third, half, or full track block.
All segments in HD Databases begin on a halfword boundary. If a
segment's total length is an odd number, the space used in an HD database
will be one byte longer than the segment. The extra byte is called
a slack byte
.
Note that the database in the figure above contains areas of free space. This free space could be the result of delete or replace operations done on segments in the data set. Remember, space can be reused in HD databases. Or it could be free space you set aside when loading the database. HD databases allow you to set aside free space by specifying that periodic blocks or CIs be left free or by specifying that a percentage of space in each block or CI be left free.
Examine the four fields illustrated in the above figure. Three of the fields are used to manage space in the database. The remaining one, the anchor point area, contains the addresses of root segments. The fields are: