Secondary indexes versus logical relationships
Both secondary indexes and logical relationships provide logical data structures, which are hierarchical data structures that are different from the data structure represented by the physical DBD. The decision about which type to use is based primarily on how application programs need to process the data. Fast Path supports only secondary indexes.
When to use a secondary index
In analyzing application requirements, if more than one candidate exists for the sequence field of a segment, use a secondary index. Choose one sequence field to be defined in the physical DBD. Then set up a secondary index to allow processing of the same segment in another sequence. For the example shown in the following figure, access the customer segment that follows in both customer number (CUSTNO) and customer name (CUSTNAME) sequence. To do this, define CUSTNO as the sequence field in the physical DBD and then define a secondary index that processes CUSTOMER segments in CUSTNAME sequence.

When to use a logical relationship
If
you have applications such as a bill-of-materials using a recursive
structure, use a logical relationship. A
recursive structure exists when there is a many-to-many association
between two segments in the same physical hierarchy. For example,
in the segments shown in the following figure, the assembly car
is
composed of many parts, one of which is an engine. However, the engine
is itself an assembly composed of many parts.

Finally, you can have application requirements that result in a segment that appears to have two parents. In the example shown in the following figure, the customer database keeps track of orders (CUSTORDN). Each order can have one or more line items (ORDLINE), with each line item specifying one product (PROD) and model (MODEL). In the product database, many outstanding line item requests can exist for a given model. This type of relationship is called a many-to-many relationship and is handled in IMS through a logical relationship.
