Physical Access Methods
Physical access methods determine the physical organization and available access paths for DL/I databases.
What Physical Access Methods Do
Physical access methods determine the physical organization and available access paths for DL/I databases. Each physical DBD must be assigned an access method, which is specified for the ACCESS parameter in the DBD statement.
Sequential and Direct Access Methods
DL/I provides two general access methods: sequential and direct. The sequential method lays out the segment occurrences as physically contiguous, like records in a tape file. The direct method provides random access via pointers to segment occurrences, like records on a direct access storage device (disk). Each method is further qualified on the basis of whether or not it supports indexing.
DL/I Supports Four Access Methods
The combination of sequential/direct and indexing/no indexing yields the following four access methods for DL/I:
- HSAM──Hierarchical sequential access method
- HISAM──Hierarchical indexed sequential access method
- HDAM──Hierarchical direct access method
- HIDAM──Hierarchical indexed direct access method
Note that all four access methods are hierarchical (H). This reflects the fact that an application always views a database as hierarchical, regardless of the access method used or the physical location of the data.
What HSAM Provides
The HSAM access method provides sequential access to root segments and child segments. The top-to-bottom, left-to-right hierarchical sequence is reflected in the physical contiguity of the database records.
Use HSAM for Sequential File Processing
The HSAM organization requires fixed-length records and is intended exclusively for conventional sequential file processing. There is no provision for making updates in place, without copying the database. Also, HSAM supports only hierarchical relationships, not logical relationships.
For more information on HSAM access method, see DL/I Access Methods in CA IDMS/DB.
What HISAM Provides
The HISAM access method provides indexed access to root segments and sequential access to child segments. The index contains the root segment sequence field values and is maintained in ascending order as part of the physical database.
As with the HSAM method, the hierarchical relationships are reflected in the physical contiguity of the database records.
HISAM uses two data sets: the primary data set and the overflow data set. Both data sets are defined with fixed-length physical records.
Primary Data Set
primary data setcontains the root segment occurrences and as many of their dependent segment occurrences as will fit. The primary data set supports indexing via the root segment sequence field values.
Overflow Data Set
overflow data setcontains the dependent occurrences that will not fit in the primary data set. Chains between the primary and overflow data sets maintain relationships and sequencing.
HISAM supports hierarchical relationships and unidirectional and bidirectional logical relationships with physical pairing. HISAM does not support bidirectional virtual relationships.
What HDAM Provides
The HDAM access method provides hashed access to root segments and pointer access to child segments. The hashing algorithm calculates the physical address of a root segment occurrence based on the value in its sequence field.
HDAM Uses a Radomizing Routine
When a database record is first loaded, the HDAM method randomizes the root key value to a physical location, which consists of a block number and an offset into the block. The root segment occurrence and all dependent segment occurrences that will fit are loaded into the block. Dependent segment occurrences that will not fit are loaded into an overflow area. Physical child and physical twin pointers are created to establish the appropriate connections.
Fast and Direct Access to Root Segments
HDAM provides fast, direct access to a root segment occurrence. With, at most, one additional I/O, it is possible to access the first occurrence of the dependent segment at the next level by following the appropriate physical child pointer.
The HDAM method supports all of the DL/I hierarchical and logical relationships.
What HIDAM Provides
The HIDAM access method provides indexed access to root segments, via the root sequence field, and pointer access to child segments. The index contains the root segment sequence field values and is maintained in ascending order.
A HIDAM database is made up of two separate databases. One database contains all of the data. The other database is the index and contains the sequence field values for the root segment occurrences.
The index database is never visible to an application, but it must be defined in its own set of DBD statements. A HIDAM index database requires the value INDEX for the ACCESS parameter in the DBD statement. The illustration below shows the DBD source statements for a HIDAM physical database (DB1) and its associated index database (DBINDEX).
DBD NAME=DB1,ACCESS=HIDAM DATASET DD1=DBHIDAM,DEVICE=3350,BLOCK=42,RECORD=48,SCAN=1 SEGM NAME=SEG1,BYTES=31,PTR=H,PARENT=0 FIELD NAME=(FIELD1,SEQ,U),BYTES=21,START=1 FIELD NAME=FIELD2,BYTES=10,START=22 LCHILD NAME=(SEG2,DBINDEX),PTR=INDX DBDGEN FINISH END DBD NAME=DBINDEX,ACCESS=INDEX DATASET DD1=DBINDEX,DEVICE=3350,BLOCK=44,RECORD=46,SCAN=1 SEGM NAME=SEG2,BYTES=21 LCHILD NAME=(SEG1,DB1),INDEX=FIELD1 FIELD NAME=(FIELD3,SEQ,U),BYTES=21,START=1 DBDGEN FINISH END
Figure 14. DBD definitions for a HIDAM database and its index database
Index Pointer Segments
An index database can contain only one segment, which is referred to as the
index pointer segment. The single SEGM statement in the index DBD names this segment. The index pointer segment points to the root segment in the physical DBD. The root segment is referred to as the
source segmentbecause it is the source of the data needed to construct the index pointer segment. The root segment is also the
target segmentbecause it is the segment that will be accessed by the index pointer. The index pointer segment contains one field, which will carry the sequence field values for the root segment occurrences. This field must also be defined as a sequence field.
LCHILD Statement Associates Databases
The physical (HIDAM) DBD and the index DBD both contain an LCHILD statement. Together, the two LCHILD statements establish the association between the databases. The NAME parameter in the physical DBD's LCHILD statement specifies the index pointer segment and the index DBD in which it is defined. The NAME parameter in the index DBD's LCHILD statement specifies the root segment and the physical DBD in which it is defined. The INDEX parameter in the index DBD's LCHILD statement specifies the sequence field in the named root segment.
The HIDAM method supports all of the DL/I hierarchical and logical relationships.