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

IMSDB Logical Databases

Logical relationship is a path between segments that otherwise would be unrelated. A logical relationship is always between two segments. Although those segments are usually in separate physical databases, that does not have to be the case; a logical relationship can also connect two segments within the same physical database.

IMS Logical Database

Consider the two independent databases (Customer and Inventory) the structures are as shown above. In the Customer database, assume, a particular receivable segment might have several subordinate line item segments, each for different product. Notice that the key of LINE ITEM segment consists of 3 byte Vendour code and 5 byte Item number.

In the Inventory DB there are three segments Viz., Vendor segment, Item Segment, Stock Location segments. Each Vendor will have lot of items in turn each item can be placed at different stock locations. Relevent portions of the two DBDs are shown below for reference.





The item number of Line Item segment (CUSTOMER) and Item number of Item segment (INVENTORY) are same. Access to Stock Locations segment can be provided by adding this segment (Stock Location Segment - INVENTORY) to the hierarchical structure of the CUSTOMER database, performing a new DBDGEN and reloading the database including the new stock location segment occurrences. The new database would then contain the stock location information, which is as shown below.

As per the database structure above, the Stock Location information is already existing in Inventory Database. So it would be redundent to store it again in CUSTOMER database. One way to gain access to both the databases is to code a PSB that contains two PCBs, one for each physical database. In such case application programs could provide the program logic to tie together the two databases.

The other approach is to use the logical relation ship concept. This provides a method for hooking two or more databases together in such a way that application programs can work with them as if they are of single logical data structure.

IMSDB Logical Database

A Logical database is an ordered set of logical database record occurrences. Like a physical database record, a logical database record is a hierarchical arrangement of fixed-length segments. Like a physical database, a Logical database is defined by means of a DBD. However a logical database differs from a physical database in that it has no existence in its own right; instead it is defined in terms of one or more existing physical databases.

Specifically each logical database record occurrence consists of segments from several distinct physical database record occurrences. Thus logical database imposes a hierarchical structure on the data that is different from the hierarchical structure represented by the underlaying physical databases; in other words it provides the user with an alternative view of the data. In IMS the logical database is really part of the conceptual level rather than the external level. Logical database will ideally look exactly like a physical database to the user, atleast as far as retrieval is concerned.

There are three ways in which a logical relationship can be established or implemented. These methods of implementation are as follows:

  1. Unidirectional Logical Relationship

  2. Bidirectional physically paired Logical Relationship

  3. Bidirectional virtually paired Logical Relationship

Let us see each implementation methods in detail.

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