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

Unidirectional Logical Relationship


In this type of relationships, logical connection goes from logical child (via physical structure) to the logical parent in one direction. A one-way path is established using a pointer in the logical child. As shown In the example below, a unidirectional logical path is created from the CUSTOMER database to the INVENTORY database, which would provide access to product data in the inventory database from the line item segment in the customer database.

Instead of duplicating the STOCK LOCATION segment in the CUSTOMER database, a new pointer is created. In logical relationship terminology, the pointer segment in the CUSTOMER physical database is called a Logical Child Segment. The segment it points to the other segment in the INVENTORY database is called a Logical Parent.

Unidirectional Logical Relationship

A particular receivable segment in the CUSTOMER database might have several subordinate line item segments, each for different product. Each of those line item segments, in turn, has a different logical parent in the inventory database. Note that one logical child segment occurrence has only one logical parent occurrence.

In the figure, the logical relationship can be used to access from the CUSTOMER to the INVENTORY database. It cannot be used to access from the INVENTORY to the CUSTOMER database, because the ITEM segment of INVENTORY database does not point to the CUSTOMER database. The change required to be made in the two physical DBDs are shown below.

CUSTOMER DBD:

SEGM    NAME=LINEITEM,PARENT=((RECVABLE),(INITMSEG,P,INDBD)),
        BYTES=16
FIELD   NAME=(ITKEYVEN,SEQ,U),BYTES=3,START=1,TYPE=C
FIELD   NAME=ITKEYNUM,BYTES=5,START=4,TYPE=C
FIELD   NAME=LIUNTPRC,BYTES=4,START=9,TYPE=P
FIELD   NAME=LIQUANTY,BYTES=4,START=13,TYPE=P

INVENTORY DBD:

SEGM    NAME=INITMSEG,PARENT=INVENSEG,BYTES=48
FIELD   NAME=(INITMNUM,SEQ),BYTES=5,START=1,TYPE=C
LCHILD  NAME=(LINEITEM,CUSTDBD)
FIELD   NAME=INITMDES,BYTES=35,START=6,TYPE=C
FIELD   NAME=INITMPRC,BYTES=4,START=41,TYPE=P
FIELD   NAME=INITMCST,BYTES=4,START=45,TYPE=P

In the CUSTOMER database, the DBD coding that differs from normal DBD coding is that for the logical child LINEITEM.

In the SEGM statement for LINEITEM:

The PARENT= parameter has two parents specified.Two parents are specified because LINEITEM is a logical child and therefore has both a physical and logical parent. The physical parent is RECVABLE. The logical parent is INITMSEG, specified after RECVABLE. Because INITMSEG exists in a different physical database from CUSTDBD, the name of its physical database, INDBD, must be specified. Between the segment name INITMSEG and the database name INDBD is the letter P. The letter P stands for physical, which means the database name followed it is a separate physical database.

In the INDBD database, the DBD coding that differs from normal DBD coding is that an LCHILD statement has been added. This statement names the logical child LINEITEM. Because the LINEITEM segment exists in a different physical database from INITMSEG, the name of its physical database, CUSTDBD, must be specified.

It is possible to establish two unidirectional relationships. Then either physical database can be entered and the logical child in either can be used to cross to the other physical database. However, IMS treats each unidirectional relationship as a one-way path. It does not maintain data on both paths. If data in one database is inserted, deleted, or replaced, the corresponding data in the other database is not updated. This maintenance problem does not exist in both bidirectional physically paired-logical and bidirectional virtually paired-logical relationships.



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