File Inversion

How to:

When you create a Master File, you create a default representation of a hierarchy. Sometimes, though, you may not want to follow the default route to retrieve records. Two situations are:

  1. Your IF criteria screen a segment at the bottom of a subtree.
  2. You are processing a multi-path report with IF criteria or sort phrases that are not on a common path.

When these situations occur, you can specify a new entry segment (root) at execution time for a specific request. This process is called file inversion because the parent/descendant relationships along the path linking the original root and the new root are reversed. Other parent/descendant relationships remain unchanged.

Note: File inversions only change the file views. They do not affect the data.


Top of page

x
Syntax: How to Invert a File
TABLE FILE filename.field

where:

field

May be any field in the new root segment.

For example, to invert the EMPFULL file so that the office segment is the new root, specify the field OFFICE_CODE:

TABLE FILE EMPFULL.OFFICE_CODE

You can also display a diagram of the inverted file with the CHECK FILE command. (Include the RETRIEVE option for a subtree diagram.):

CHECK FILE filename.fieldname PICTURE  [RETRIEVE]

You cannot invert a Master File if:

File inversion is a simple solution to two common problems:



Example: Using File Inversion to Solve Sort Path Problems

In addition to solving the sort path problem, file inversion can improve I/O efficiency which, in turn, minimizes production costs.

Consider this request:

TABLE FILE EMPFULL
LIST SKILL_LEVEL BY SALARY_GRADE
END

In panel 1 of the following figure, an error occurs because segments C and B are not on the same path. Therefore, you must use an inverted view:

TABLE FILE EMPFULL.SALARY_GRADE
LIST SKILL_LEVEL BY SALARY_GRADE
END

In the inverted view (panel 2), segment C is a descendant of segment B. Using this inverted view, the request can be executed.

As this request is executed, record occurrences multiply. Every record of segment C is paired with every record in segment B. If, for example, A had two B descendants and four C descendants, the report would contain eight lines of output. This effect is advantageous when it is necessary to pair every record associated with one linkpath to a record associated with another linkpath. Record pairing may produce undesirable results when the inverted segments are not directly related to each other.

If you use file inversion in conjunction with MISSING=ON, you may access orphan record occurrences that could not be accessed with the default Master File. An orphan record occurrence is one that has no parent record connection. Due to the network structure of IDMS, any hierarchical view may contain orphans. IDMS set connection options OA, OM, or MM indicate the possibility of orphans. Inversion enables the adapter to reconstruct the IDMS relationships so that these orphans can be retrieved.


Information Builders