Sie sind auf Seite 1von 3

IMS V13 - Database administration - Specifying lo... https://www-01.ibm.com/support/knowledgecente...

Specifying logical relationships in the physical DBD


For each of the databases involved in a logical relationship, you must code a physical DBD.

All statements in the physical DBD are coded with the same format used when a logical relationship is not
defined, except for the SEGM and LCHILD statements. The SEGM statement, which describes a segment
and its length and position in the database hierarchy, is expanded to include the new types of pointers.
The LCHILD statement is added to define the logical relationship between the two segment types.

In the SEGM statements of the examples associated with the following figures, only the pointers required
with logical relationships are shown. No pointers required for use with HD databases are shown. When
actually coding a DBD, you must ask for these pointers in the PTR= parameter. Otherwise, IMS™ will not
generate them once another type of pointer is specified.

The following figure shows the layout of segments.

Figure 1. Layouts of segments used in the examples

1 of 3 11/04/2015 01:10 PM
IMS V13 - Database administration - Specifying lo... https://www-01.ibm.com/support/knowledgecente...

This is the hierarchical structure of the two databases involved in the logical relationship. In this example,
we are defining a unidirectional relationship using symbolic pointing. ORDITEM has an LPCK and fixed
intersection data, and DELIVERY and SCHEDULE are variable intersection data.

The following figure shows physical DBDs for unidirectional relationships.

Figure 2. Physical DBDs for unidirectional relationship using symbolic pointing

The following DBD is for the ORDER database:

DBD NAME=ORDDB
SEGM NAME=ORDER,BYTES=50,FREQ=28000,PARENT=0
FIELD NAME=(ORDKEY,SEQ),BYTES=10,START=1,TYPE=C
FIELD NAME=ORDATE,BYTES=6,START=41,TYPE=C
SEGM NAME=ORDITEM,BYTES=17,PARENT=((ORDER),(ITEM,P,ITEMDB))
FIELD NAME=(ITEMNO,SEQ),BYTES=8,START=1,TYPE=C
FIELD NAME=ORDITQTY,BYTES=9,START=9,TYPE=C
SEGM NAME=DELIVERY,BYTES=50,PARENT=ORDITEM
FIELD NAME=(DELDAT,SEQ),BYTES=6,START=1,TYPE=C
SEGM NAME=SCHEDULE,BYTES=50,PARENT=ORDITEM
FIELD NAME=(SCHEDAT,SEQ),BYTES=6,START=1,TYPE=C
DBDGEN
FINISH
END

The following DBD is for the ITEM database:

DBD NAME=ITEMDB
SEGM NAME=ITEM,BYTES=60,FREQ=50000,PARENT=0
FIELD NAME=(ITEMKEY,SEQ),BYTES=8,START=1,TYPE=C
LCHILD NAME=(ORDITEM,ORDDB)
DBDGEN
FINISH
END

In the ORDER database, the DBD coding that differs from normal DBD coding is that for the logical child

2 of 3 11/04/2015 01:10 PM
IMS V13 - Database administration - Specifying lo... https://www-01.ibm.com/support/knowledgecente...

ORDITEM.

In the SEGM statement for ORDITEM:

1. The BYTES= parameter is 17. The length specified is the length of the LPCK, plus the length of
the fixed intersection data. The LPCK is the key of the ITEM segment, which is 8 bytes long. The
length of the fixed intersection data is 9 bytes.
2. The PARENT= parameter has two parents specified. Two parents are specified because
ORDITEM is a logical child and therefore has both a physical and logical parent. The physical
parent is ORDER. The logical parent is ITEM, specified after ORDER. Because ITEM exists in a
different physical database from ORDITEM, the name of its physical database, ITEMDB, must be
specified. Between the segment name ITEM and the database name ITEMDB is the letter P. The
letter P stands for physical. The letter P specifies that the LPCK is to be stored on DASD as part of
the logical child segment.

In the FIELD statements for ORDITEM:

1. ITEMNO is the sequence field of the ORDITEM segment and is 8 bytes long. ITEMNO is the
LPCK. The logical parent is ITEM, and if you look at the FIELD statement for ITEM in the ITEM
database, you will see ITEM's sequence field is ITEMKEY, which is 8 bytes long. Because ITEM is
a root segment, the LPCK is 8 bytes long.
2. ORDITQTY is the fixed intersection data and is coded normally.

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

Specifying bidirectional logical relationships


When defining a bidirectional relationship with physical pairing, you need to include an LCHILD
statement under both logical parents and, in addition to other pointers, the PAIRED operand on the
POINTER= parameter of the SEGM statements for both logical children.

Checklist of rules for defining logical relationships in physical databases


You must follow certain rules when defining logical relationships in physical databases.

Parent topic: Logical relationships

Related concepts:
PSBs, PCBs, and DBDs in logical relationships

3 of 3 11/04/2015 01:10 PM

Das könnte Ihnen auch gefallen