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

Rules for Defining Logical Relationships


Rules for Defining Logical Relationships in Physical Databases:

Note that in all cases below, references are to segment types, not occurrences.

Logical Child:

  • A logical child must have a physical and a logical parent.

  • A logical child can have only one physical and one logical parent.

  • A logical child is defined as a physical child in the physical database of its physical parent.

  • A logical child is always a dependent segment in a physical database, and can, therefore, be defined at any level except the first level of a database.

  • A logical child in its physical database cannot have a physical child defined at the next lower level in the database that is also a logical child.

  • A logical child can have a physical child. However, if a logical child is physically paired with another logical child, only one of the paired segments can have physical children.

Logical Parent:

  • A logical parent can be defined at any level in a physical database, including the root level.

  • A logical parent can have one or more logical children. Each logical child related to the same logical parent defines a logical relationship.

  • A segment in a physical database cannot be defined as both a logical parent and a logical child.

  • A logical parent can be defined in the same physical database as its logical child, or in a different physical database.

Physical Parent:

  • A physical parent of a logical child cannot also be a logical child.


Rules for Defining Logical Databases:

  • The root segment in a logical database must be the root segment in a physical database.

  • A logical database must use only those segments and physical and/or logical relationship paths defined in the physical DBD referenced by the logical DBD.

  • The path used to connect a parent and child in a logical database must be defined as a physical relationship path or a logical relationship path in the physical DBD referenced by the logical DBD.

  • Physical and logical relationship paths can be mixed in a hierarchic segment path in a logical database.

  • Additional physical relationship paths, logical relationship paths, or both paths can be included after a logical relationship is crossed in a hierarchic path in a logical database. These paths are included by going in upward directions, downward directions, or both directions, from the destination parent. When proceeding downward along a physical relationship path from the destination parent, direction cannot be changed except by crossing a logical relationship. When proceeding upward along a physical relationship path from the destination parent, direction can be changed.

  • Dependents in a logical database must be in the same relative order as they are under their parent in the physical database. If a segment in a logical database is a concatenated segment, the physical children of the logical child and children of the destination parent can be in any order. The relative order of the children or the logical child and the relative order of the children of the destination parent must remain unchanged.

  • The same concatenated segment type can be defined multiple times with different combinations of key and data sensitivity. Each must have a distinct name for that view of the concatenated segment. Only one of the views can have dependent segments. Figure 69 shows the four views of the same concatenated segment that can be defined in a logical database. A PCB for the logical database can be sensitive to only one of the views of the concatenated segment type.


How Logical Relationships Affect Programming:

The calls you issue to process segments in logical relationships are the same calls that you use to process other segments. However, the processing is different in the following ways: how the logical segment looks in your I/O area, what the DB PCB mask contains after a retrieve call, and how you can replace, delete, and insert physical and logical parent segments.

Because it is possible to access segments in logical relationships through the logical path or the physical path, the segments must be protected from being updated by unauthorized programs.

When the DBA defines logical relationships, it defines a set of rules that determine how the segments can be deleted, replaced, and inserted. Defining these rules is a database design decision. If the program processes segments in logical relationships, the following information from the DBA is required.

  • What segments look like in the I/O area when they are retrieved

  • Whether or not the program is allowed to update and insert segments

  • What to do if a DX, IX, or RX status codes are received

Inserting a logical child segment has the following requirements:

  • In load mode, the logical child can be inserted only under its physical parent. Logical parent in the I/O area need not be supplied.

  • In update mode, the format of the logical child is different, depending on whether it is accessed from its physical parent or from its logical parent.

  • If accessed from its physical parent, the format of the logical child is the concatenated key of the logical parent followed by intersection data.

  • If accessed from its logical parent, the format of the logical child is the concatenated key of the physical parent, followed by intersection data.

  • The logical child can be inserted or replaced depending on the insert rule for the logical or physical parent. Unless the insert rule of the logical or physical parent is PHYSICAL, the logical or physical parent must be supplied in the I/O area following the logical child.



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