Mapping IMS and FOCUS Relationships

The join is an important technique for reporting from any database system. A join enables you to report from more than one database at the same time by matching values of fields from each database.

With most FOCUS Interfaces, you can join separate databases or files that share a common field by describing each file as a segment in one multi-structure Master File. This embedded join technique is not available with the IMS/DB Interface since each Master File must describe one PCB and each PCB must describe one DBD.

The following sections describe the techniques available for relating separate IMS databases.


Top of page

IMS Logical Relationships

In IMS, a PCB can describe a logical database, and a logical DBD can describe a relationship between multiple IMS databases. Therefore, a Master File can describe a join between separate IMS databases if there is a PCB for a DBD that describes the join.

The Interface cannot distinguish between a DBD for a physical database and a DBD for a logical database. You create the Master Files using identical techniques and attributes.


Top of page

Alternating Between Databases

The PSB provides the ability to report from separate IMS databases. The PSB can contain PCBs for multiple databases, and an application can use all PCBs from a PSB. However, this is not a join since there is no automatic matching of common field values from the separate databases and, in fact, the databases do not have to be related in any way.


Top of page

The Dynamic JOIN

The Interface provides the dynamic JOIN command for joining separate databases. You can issue a JOIN command at run time to join IMS databases that have PCBs in the same PSB. In fact, with the appropriate Interfaces installed, you can implement joins between IMS databases and non-IMS databases or files (for example, DB2 tables, MODEL 204 files, and FOCUS databases).

The databases to be joined must have at least one field that shares common values. In order to join "to" an IMS database, you must join to a key field or secondary index in the root segment.

The following diagram illustrates a dynamic join between separate IMS databases:

  1. Shows two IMS DBDs. DBD1 has a field called SOCSEC that is not a key and not in the root segment. DBD2 has a field called SSN that shares the same values as SOCSEC. The field SSN is the root key of DBD2.

  1. Is a PSB that has PCBs for DBD1 and DBD2. Each PCB is sensitive to the segment containing the shared field.

  2. Is the FOCPSB. It associates the first PCB with Master File FILEA and the second PCB with Master File FILEB.

  3. Is a FOCUS session or FOCEXEC that issues the JOIN command to join the two Master Files. Notice that the "to" field in the JOIN command is a key in the root segment.


Information Builders