TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

IMS Access Methods


There are several IMS access methods available, that retrieve and manipulate the segments stored in a data base. These access methods are as follows.

  1. The Hierarchical Sequential Access Method (HSAM).

  2. The Hierarchical Indexed Sequential Access Method (HISAM).

  3. The Hierarchical Direct Access Method (HDAM).

  4. The Hierarchical Indexed Direct Access Method (HIDAM).


Hierarchical Sequential Access Method (HSAM):

The adjective that best describes HSAM is tapelike. The hierarchical sequence is represented entirely by physical contiguity. In other words, segments are arranged physically in hierarchical sequence. No provision is made for directly accessing a particular root segment. All segments, including root segments, are stored in hierarchical sequence, and random retrieval of a root segment is performed by scanning through all the segments up to that root.

An HSAM database is created by means of a series of Insert operations. Note that the segments to be loaded must be presented in hierarchical sequence. Once created the data base may be used only for Input. HSAM segments cannot be deleted or replaced and new segment occurrences cannot be inserted into an existing data base.

To update the data base, an application must process the old HSAM data base as input and create a new version of the HSAM data base using Insert Calls in the load mode.


Hierarchical Indexed Sequential Access Method (HISAM):

It can be characterized, a little inaccurately, by saying that it provides indexed access to the root segments, sequential access to the subordinate segments. The main difference between HSAM and HISAM is in the way the root segments are accessed. With HISAM, a VSAM or ISAM index is used to locate root segments.

The index is nondense, so that in general there will be many roots for each index entry. Access to dependent segments is sequential, in as much as to access the Nth dependent of a particular root, it is necessary to traverse all the (N-1) dependents that precede it.

HISAM tends to be inefficient when the data base is subject to a lot of additions and deletions. In general, HISAM is a good access method to use when random access is required to root segments and when data base records are fairly small, or when access to dependent segments is always sequential.

An HISAM data base uses either a combination of ISAM (Indexed Sequential Access Method) and OSAM (Overflow Sequential Access Method) or VSAM (Virtual Storage Access Method) as its supporting access method.

When the database is initially loaded (remember that loading must be done in hierarchical sequence), each root segment presented causes a new ISAM stored record to be created; the root segment is placed at the front of this record, and as many dependent segments as will fit are placed after the root.

If the ISAM record is filled before all dependents of the current root have been loaded, then a new OSAM record is created and the next dependent is placed at the front of that; also the relative address of the OSAM record is placed in the next dependent pointer position in the ISAM record. Subsequent dependents follow this one in the OSAM record.

If the OSAM record is in turn filled, another is created and so on. Thus each physical database record occurrence is represented as a chain containing one ISAM record together with zero or more OSAM record. Deletion of a segment in HISAM is accomplished by setting a flag in the segment prefix. Dependents of the deleted segment are automatically considered as deleted.

The ISAM and OSAM data sets are replaced by a VSAM key-sequenced and a VSAM entry-sequenced data set respectively. All root segments reside in the key-sequenced data set, even insertions. When a new root is inserted, it is placed in its proper position in this data set and the VSAM index is updated if necessary.


Hierarchical Direct Access Method (HDAM):

HDAM provides direct access (by sequence field value) to the root segments, via a hashing and chaining technique, together with pointer access to the subordinate segments. In its simplest form, an HDAM database consists of a single OSAM data set or a single VSAM entry-sequenced data set, divided up into fixed-length stored records.

HDAM differs from the other structures in that initial loading of the database need not be performed in sequence. More accurately, root segments may be presented for loading in any order; however all dependents of a given root must be presented in strict hierarchical sequence before the next root is loaded. When a root segment is presented for loading, the value of its sequence field is passed to a DBA-supplied hashing routine, which hashes the value and generates the address of a record within the root segment addressable area.

Inserting a new segment does not cause any existing segments to be moved in HDAM. This is made possible by the pointers which allow the space allocation routines to place an inserted segment at any convenient position while still maintaining both the hierarchical sequence and the ability to access the two structures.

In HISAM deletions are indicated merely by setting a flag in the segment prefix. In HDAM, however, the space occupied by the deleted segment is made available for reuse, so that a subsequent insertion may cause the segment to be physically overwritten.


Hierarchical Direct Access Method (HDAM):

HIDAM provides indexed access to the root segments, pointer access to the subordinate segments. As in HISAM, the indexing is on the root segment sequence field. A HIDAM data base actually consists of two databases; a ‘data’ database, which contains the actual data, and an associated INDEX database, which provides the index.

The ‘data’ database consists in its simplest form of a single OSAM data set or a single VSAM entry-sequenced data set, divided up into fixed length stored records. The initial loading of the database must be performed in hierarchical sequence. As each segment is presented, it is placed in the data set at the next available position in sequence as if this were an HSAM database.

In addition, of course, the appropriate pointer values are placed in relevant prefixes. Subsequent deletions are handled exactly as in HDAM; that is space is freed and may be used for segments added later. The subsequent insertion of a root segment will cause the new root to be placed as near as possible to the root that precedes it in hierarchical sequence. Subsequent insertion on a dependent segment will cause the new segment to be placed as near as possible to its immediate predecessor in hierarchical sequence. (As in HDAM, segments never move once they have been stored.



If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!

Are you looking for Job Change? Job Portal