Customizing the IDMS/DB Environment

Topics:

Using WebFOCUS, you can customize the IDMS/DB environment by inverting files and joining Master Files.

File Inversion

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:

  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, 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.

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:

  • The path linking the old and new roots passes through segments that have a CALC- or index-based relationship.
  • The GETOWN parameter in the ACCESS File for a set-based relationship is set to N.
  • It is an LRF Master File.

File inversion is a simple solution to two common problems:

  • Denied access because the segment is on the wrong sort path.
  • Denied access because the field named in an IF test is not on the root path.

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/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.

Joining Master Files

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:

  • Other IDMS/DB data sources (SUFFIX=IDMSR)
  • VSAM or ISAM or QSAM
  • SQL or UDB (Db2)
  • DOS/DL1 or IMS
  • CA-Datacom/DB
  • MODEL 204
  • Fixed-format sequential

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:

  • An IDMS/DB CALC field on a network record-type.
  • An indexed field (FIELDTYPE=I) on a network record-type.
  • A field on an LRF record.

The fields on the host file can be:

  • A virtual field located in a host Master File or created as a separate command.
  • Any field.

In the Master File, the names of common fields can differ, but their field formats (ACTUAL and USAGE) must be the same.

Syntax: How to Join Two Data Sources

JOIN field1 [WITH rfield] IN hostfile [TAG tag1]
TO [ALL] field2 IN crfile [TAG tag2] [AS name]
[END]

where:

field1, field2

Are the fields common to both Master Files.

WITH rfield

Use only if field1 is a virtual field; assigns a logical home with a real field in the host file.

hostfile

Is the host Master File.

TAG tag1

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.

ALL

Use if non-unique relationships exist in the target file.

crfile

Is the target or cross-referenced Master File.

TAG tag2

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.

AS name

Assigns a name to the JOIN structure. You must assign a unique name to a join structure if:

  • You want to ensure that a subsequent JOIN command will not overwrite it.
  • You want to clear it selectively later.
  • The structure is recursive, and you do not specify tag names.
END

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

Reference: Usage Notes for the JOIN Command

  • Up to 16 joins may be active in one session.
  • For a DML target file, field2 must be indexed (FIELDTYPE=I).
  • If you intend to use a virtual field as field1, specify its field name in the JOIN command and then issue its DEFINE command. Any DEFINE commands issued prior to the JOIN are cleared.
  • If you know that the target file is unique, omit the ALL in the JOIN command; omitting ALL reduces I/O overhead.
  • To display the JOIN structure, use the CHECK FILE command and specify the name of the host file.

Syntax: How to List JOIN Structures

To list your JOIN structures, enter:

? JOIN

Syntax: How to Clear JOIN Structures

To clear a specific JOIN structure, specify the name that you assigned to the join:

JOIN CLEAR name

Syntax: How to Clear All JOIN Structures

To clear all structures, use an asterisk (*) instead of a join name:

JOIN CLEAR *

Example: Reporting From a Joined Structure

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

WebFOCUS

Feedback