In this section: |
Using WebFOCUS, you can customize the IDMS/DB environment by inverting files and joining Master Files.
How to: |
When you create a Master File, you create a default representation of a hierarchy. Sometimes, however, you may not want to follow the default route to retrieve records. Two such instances might be when:
When these situations occur, using WebFOCUS 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.
TABLE FILE filename.field
where:
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:
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/DB, any hierarchical view may contain orphans. IDMS/DB set connection options OA, OM, or MM indicate the possibility of orphans. Inversion enables the adapter to reconstruct the IDMS/DB relationships, so that these orphans can be retrieved.
How to: Reference: |
Using WebFOCUS, you can join the Master Files describing any of these data sources to that of your IDMS/DB data source:
A JOIN structure is implemented by matching one field that is common to both data sources. The fields on the IDMS/DB target file can be:
The fields on the host file can be:
In the Master File, the names of common fields can differ, but their field formats (ACTUAL and USAGE) must be the same.
JOIN field1 [WITH rfield] IN hostfile [TAG tag1] TO [ALL] field2 IN crfile [TAG tag2] [AS name] [END]
where:
Are the fields common to both Master Files.
Use only if field1 is a virtual field; assigns a logical home with a real field in the host file.
Is the host Master File.
Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in the host file.
The tag name for the host file must be the same in all the JOIN commands of a joined structure.
Use if non-unique relationships exist in the target file.
Is the target or cross-referenced Master File.
Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in the cross-referenced file. In a recursive joined structure, if no tag name is provided, all field names and aliases are prefixed with the first four characters of the join name.
Assigns a name to the JOIN structure. You must assign a unique name to a join structure if:
Required when the JOIN command is longer than one line; terminates the command.
To join more than two files as a single structure, indicate the common fields as follows:
JOIN field1 IN file1 TO field2 IN file2 AS name1 JOIN field3 IN file1 TO field4 IN file3 AS name2
To clear a specific JOIN structure, specify the name that you assigned to the join:
JOIN CLEAR name
To clear all structures, use an asterisk (*) instead of a join name:
JOIN CLEAR *
This example joins the DML data source JOBFILE to the IDMS/DB EMPFULL data source based on job codes. First the JOBCODE field in JOBFILE is edited to make it compatible with the JOB_ID field in EMPFULL. The JOIN command is issued prior to the DEFINE. If the DEFINE were issued first, it would be cleared by the JOIN command:
JOIN JOBID WITH JOBCODE IN JOBFILE TO ALL JOB_ID IN EMPFULL AS J1 END DEFINE FILE JOBFILE JCODE/A2 = IF JOBCODE LIKE 'A__' THEN '10' ELSE '20'; JOBID/A4 = JCODE|EDIT(JOBCODE,'$99'); END TABLE FILE JOBFILE SUM EMP_NAME IN 25 TITLE BY DEPT_NAME END
The output is:
DEPT_NAME EMP_NAME TITLE --------- -------- ----- ACCOUNTING AND PAYROLL RUPERT JENSON MGR ACCTNG/PAYROLL PERSONNEL ELEANOR PEOPLES MGR PERSONNEL
iWay Software |