The Disk Map file (DMAP) keeps track of what blocks are in use and what blocks are available.
It is basically a bit-map, where a bit corresponds to an RDA.
If the bit is zero, that RDA is available. If the bit is one, the RDA is in use by some file.
The data is arranged in ‘records’ such that each record represents one cylinder on the LU.
Word zero contains the RDA of the first block on the cylinder,
word one contains the number of blocks still available on the cylinder,
and the remaining words in the record consist of a bit map of sectors, using one word for each track on the cylinder.
As a result, disk drives with different cylinder sizes will have different DMAP record sizes.
Since a word is made up of 16 (dec) bits, there is a maximum of 16 sectors per track.
If a given disk drive has physically more than 16 sectors, the driver is usually designed to act as if there are twice as many tracks and half as many sectors, so that DMAP can be laid out as if the drive had 16 or fewer sectors per track. For example, a drive with 24 sectors and 5 tracks would be defined as 12 sectors and 10 tracks.
The bits in a given track word represent RDA’s. The lowest order bit (ie. 01) would represent sector 0 of that track, and the high order bit (0100000) would represent sector 15 (dec). If the track has fewer than sixteen sectors, the upper bits are set to ‘1’ in all track words. For example, if there are 12 sectors per track, an empty DMAP track word would appear as ‘170000’. The lower 12 (dec) bits showing the available blocks.
The DMAP file for LU0 is rebuilt in its entirety during an IPL. The DMAP file for other LU’s is rebuilt in its entirety during an INSTALL (but not INSTALL FAST).
The file is created with all blocks available, and then the INDEX is scanned for all file headers, which are examined to determine what blocks are in use, and all of those blocks are set to in-use in DMAP. This compensates for any power failure or other possible cause for blocks not being allocated correctly.
This also means that if you change CONFIG to define more cylinders on an existing LU, the DMAP file could be made larger and clobber whatever blocks may be directly in its path. DMAP is contiguous, and it takes priority. When the system then rescans the files to setup its block allocations, it will encounter the problem and delete any file overwritten by DMAP.
In addition, the 6 blocks immediately following DMAP on LU0 are used for nesting disc-resident DISCSUBS when they call each other (to preserve any temporary storage in the discsub). These nesting blocks are never defined as a file, but the IPL will allocate them anyway. If DMAP is increased in size, the swapping blocks will move, and if they collide with a file, it will be deleted.