Overview of IMS Concepts

In this section:

FOCUS requires a Master File that describes any data source it accesses. Since IMS and FOCUS both view a database as a hierarchical multipath tree, describing a particular view of an IMS database to FOCUS is straightforward. However, IMS uses several specialized control blocks for regulating access to its databases by an application, and FOCUS requires additional information for negotiating its way through these control blocks.

The rest of this section explains the concepts necessary for retrieving information from IMS databases. Mapping IMS Elements to FOCUS and Mapping IMS and FOCUS Relationships describe rules for implementing these IMS concepts in FOCUS. Creating FOCUS Descriptions provides detailed syntax rules for FOCUS file descriptions.


Top of page

x
Hierarchical Structure

In this section:

A hierarchical database is a collection of segments associated through parent-child relationships. Each segment is a child (or dependent) of the segment directly above it in the hierarchy and is the parent of all segments directly below it. A segment can have multiple children or no children, but it can have only one physical parent. Segment instances of the same type with the same parent are called twins. The root segment is the segment at the top of the tree. It has no parent.

The following diagram depicts a hierarchical database structure:

Each box represents a segment instance in the hierarchy. (Although the diagram depicts two instances of each segment type, there may be more or fewer instances of any type.) The numbers in the boxes indicate the order in which IMS accesses the segments when an application requests sequential access (for situations that allow sequential access). This ordering of segments is called the hierarchical sequence. A database record consists of a root segment instance along with all of its descendant segment instances in hierarchical sequence. The hierarchical path to a segment instance consists of the segment itself and all of its ancestors starting from the root.

A segment consists of fields. A field is the smallest logical unit of data that an application can request.



x
Sequence Fields

In IMS, the key field of a segment is called the sequence field. It identifies the segment. A key is called unique if no two segments can contain the same key value.

The value of the sequence field for a segment determines its position in its chain of twins (segments of the same type under the same parent). The primary key for an IMS database is the sequence field of its root segment. This key identifies and orders the records of the database.

In some IMS databases, the records are physically stored in root key order. In others, the roots are stored randomly and retrieved using a hash code (randomizing function) or an index.

Dependent segments are always retrieved by searching sequentially from the parent to the first instance of the child segment type and then through each occurrence of the child segment type, in order, until the required instance is found. In some types of IMS databases, dependent segments are physically stored in order of their sequence field (if there is one). In others, the sequence is maintained by pointers from one child to the next. However, even in this case, the instances are initially loaded in sequence field order.



x
Secondary Indexes

If you want to access a segment in order of a field that is not its sequence field, IMS provides the option of creating a secondary index on the field. In some situations, using a secondary index improves performance. The secondary index is itself a separate database. Each of its records contains a value of the field to be indexed and a pointer to the target segment of the database record containing that value.

When using a secondary index, IMS locates a record by first reading the index database to retrieve the appropriate pointer and then using the pointer to read the data database.



x
Logical Relations

Another way to alter the order in which IMS views and retrieves segments is through logical relations. A logical relation associates segments from one or more databases as logical (virtual) parents and children. The adapter cannot distinguish a logical database from a physical database and can access both equally.



x
Search Fields

IMS database descriptions (DBDs) do not necessarily describe every field in the database. They include entries for all sequence fields, but other fields are optional.

When a DL/I retrieval request needs to locate specific database records, it can include selection criteria on particular fields. In some cases these search fields are not sequence fields. In order to reference them in a DL/I call, the DBD must include descriptions of these fields. See Describing a Database: The DBD in Overview of IMS Control Blocks for more information about IMS database descriptions.



x
Symbolic Pointers

When IMS traverses a database, it may follow pointers from one segment to the next. In many cases the pointers are symbolic. That is, they are key field values rather than actual addresses. The symbolic pointer to a segment instance (also called its concatenated key) is the concatenation of the key values of all segments along the hierarchical path to that segment, starting from the root. All access to dependent segments is through the root.


Top of page

x
Overview of IMS Access Methods

IMS supports several specialized access methods for storing and retrieving segments of a database. These can be subdivided into sequential and direct access methods. In the sequential methods, IMS maintains the hierarchical sequence by physically placing the segments in sequence. In the direct methods, IMS maintains the sequence with pointers. The adapter supports any IMS access method that allows command codes and qualified SSAs. The most common ones are:


Top of page

x
Overview of IMS Control Blocks

In this section:

IMS uses special control blocks for describing a database, regulating application access to databases, and communicating with an application. This section briefly describes these control blocks.



x
Describing a Database: The DBD

The DBD (Data Base Description) is a control block that describes the structure of a physical or logical database. It contains information necessary for locating particular segments, specifies access method and ddname allocation information, and describes the hierarchical structure of the database.

To describe the structure of the database, the DBD contains SEGM and FIELD statements:

If the database participates in a logical relation, the DBD may include logical child information.

After the actual database description, the DBD includes a DBDGEN statement that instructs IMS to take the user-provided DBD source statements and create a load module that the system can use. Sample File Descriptions, illustrates sample DBDs.



x
Defining Application Access to Databases: The PSB

The PSB (Program Specification Block) contains information about authorization of an application to use databases. Each view of a database that the application can access is described within the PSB. This description is called a PCB (Program Communication Block, described in Describing a Database View and Communicating With the DBMS: The PCB). Therefore, the PSB is simply a collection of PCBs.

The PSB can contain two types of PCB. One type provides access to databases (TYPE=DB) and the other type implements teleprocessing communication and batch checkpointing (this type is called an I/O PCB, TYPE=TP). The PSB can contain duplicate PCBs for maintaining multiple positions within a database or for performing recursive joins. The PSB can also include multiple PCBs for the same database in order to provide different views of the database or to allow different types of access to the database.

The PSB ends with a PSBGEN macro statement that contains information about the PSB, such as its name. The PSBGEN creates a load module from the source statements. Sample File Descriptions illustrates sample PSBs.



x
Describing a Database View and Communicating With the DBMS: The PCB

A PCB (Program Communication Block) has several functions:

In a PSB, the PCBs are listed one after another prior to the PSBGEN statement. I/O PCBs must come before database PCBs. A segment cannot be included in a PCB unless its parent is also included. For the root segment, PARENT=0.

An application program can use all PCBs in a PSB concurrently. The program gives a name to each PCB and defines its structure by applying a mask that allocates program variables to receive the status information returned by IMS. Although IMS returns status information to the PCB, it does not place the retrieved database segment into the PCB. The segment goes into an I/O area identified in the DL/I call (see Overview of DL/I Calls). For PCB examples, refer to the PSB samples in Sample File Descriptions.

The following diagram illustrates the relationship between DBDs, PSBs, and PCBs.



x
Key Sensitivity

All access to segments within an IMS database proceeds from the root segment through the hierarchical path to the desired segment. When an application has no use for the data in a segment, but does need data from one of its children, the PCB can specify PROCOPT=K to make the parent segment key sensitive. This gives IMS access to the key value of the segment but instructs it not to return any data from the segment to the application.



x
Field Level Sensitivity

A PCB can include an optional list of sensitive fields for a segment (the SENFLD statement). If it does, IMS returns only those fields to the application, not the entire segment. This field level sensitivity provides data independence and security. Even if the segment changes, the PCB and application program can remain the same. Also, for security purposes, application programs can only access specified fields.



x
Status Codes

IMS stores a status code in the PCB after each DL/I call. The adapter checks the status code after each call to determine whether the call was successful and if not, why not.



x
Key Feedback Area

After a successful call, the key feedback area in the PCB contains the concatenated key of the retrieved segment (the keys of each segment in the hierarchical path to the retrieved segment).



x
The ACB

An ACB is an optimized PSB that contains a combination of information from the PSB and the DBD. However, even with an ACB, the normal PSB is still required. ACBs are created by an ACBGEN and are used to access online databases.


Top of page

x
Overview of DL/I Calls

In this section:

To access an IMS database, an application program must call a special DL/I subroutine, such as ASMTDLI (Assembler to DL/I). Each DL/I call passes IMS the following arguments:



x
Segment Search Arguments

If you want to retrieve a specific segment or type of segment, you must tell IMS how to find it. You do this by means of segment search arguments (SSAs).

There are two types of SSAs:

SSAs can also include command codes that alter the way in which IMS completes the call. For example, the FIRST command code (*F) instructs IMS to begin its search at the start of the twin chain for that segment type, under the current parent, even if the PCB is positioned past that point. The adapter uses only one command code, the *U (parentage) command code. Tracing Adapter Processing, includes a trace example that demonstrates the use of this command code.



x
Get Calls

The adapter retrieves data from IMS using two types of Get calls:

For a discussion of how the adapter creates SSAs, see Reporting Efficiencies.


Information Builders