• No results found

Changing DBDs with logical relationships

In document The Complete IMS HALDB Guide (Page 132-136)

Chapter 8. Migration from non-HALDB to HALDB

8.6 Migrating databases with logical relationships

8.6.1 Changing DBDs with logical relationships

There are three types of logical relationships for non-HALDB databases. They are:

򐂰 Unidirectional

򐂰 Bidirectional with physical pairing

򐂰 Bidirectional with virtual pairing

HALDB supports unidirectional and bidirectional with physical pairing. It does not support virtual pairing. The following types of migrations of logical relationships are supported:

򐂰 Unidirectional to unidirectional

򐂰 Bidirectional with physical pairing to bidirectional with physical pairing

򐂰 Bidirectional with virtual pairing to bidirectional with physical pairing

HALDB HD Unload HD Reload HD Unload HD Reload HD Unload HD Reload Secondary Index 1 Secondary Index 2 Indexed Database Secondary Index 1 Secondary Index 2 Indexed Database Non-HALDB

8.6.2 Changing DBDs with logical relationships

The DBDs for databases with logical relationships may have to be modified when converting to HALDB. There are two reasons for this. First, some pointer options are not supported with HALDB. Second, HALDB does not support virtual paring with bidirectional logical relationships.

The DBDs for logical databases are not changed when the physical databases they reference are migrated. DBDs for logical databases have

ACCESS=LOGICAL in their DBD statements.

Changing pointer options for logical relationships

Logically related databases may require changes to pointers in addition to those required for databases that do not have logical relationships.

HALDB does not use symbolic pointers. Any logical relationship implemented with symbolic pointing must be changed. This is done by adding the LPARNT keyword to the PTR parameter on the SEGM statement for the logical child. Even though symbolic pointing is not used, the concatenated key of the logical parent is stored in the logical child. This is done no matter what keywords you use in the PARENT parameter. That is, PHYSICAL or P will be used even if you specify VIRTUAL or V. To avoid the warning message that is issued when VIRTUAL or V is specified, you should specify the PHYSICAL or P keyword.

Recognizing virtual pairing

You may determine if you have virtual pairing by examining your DBDs. If your HDAM or HIDAM database contains a SEGM statement with a SOURCE parameter, this segment is a virtual logical child. The first subparameter of SOURCE identifies the real logical child. The third subparameter identifies the database in which the real logical child resides. In Example 8-26 the NAMESKIL segment in the DBD contains a SOURCE parameter. It is a virtual logical child. The source parameter references the SKILNAME segment in the SKILLINV database in Example 8-27 on page 116. SKILNAME is a real logical child.

Example 8-26 HIDAM DBD with a logical relationship

DBD NAME=PAYROLDB,ACCESS=HIDAM DATASET DD1=PAYHIDAM,BLOCK=1648,SCAN=3 SEGM NAME=NAMEMAST,PTR=TWINBWD,RULES=(VVV), X BYTES=150 LCHILD NAME=(INDEX,INDEXDB),PTR=INDX LCHILD NAME=(SKILNAME,SKILLINV),PAIR=NAMESKIL,PTR=DBLE FIELD NAME=(EMPLOYEE,SEQ,U),BYTES=60,START=1,TYPE=C SEGM NAME=NAMESKIL,PARENT=NAMEMAST,PTR=PAIRED, X SOURCE=((SKILNAME,DATA,SKILLINV)) FIELD NAME=(TYPE,SEQ,U),BYTES=21,START=1,TYPE=C

DBDGEN FINISH END

Example 8-27 HDAM DBD with a logical relationship

DBD NAME=SKILLINV,ACCESS=HDAM,RMNAME=(DFSHDC40,1,500,824) DATASET DD1=SKILHDAM,BLOCK=1648,SCAN=0 SEGM NAME=SKILMAST,BYTES=31,PTR=TWINBWD FIELD NAME=(TYPE,SEQ,U),BYTES=21,START=1,TYPE=C SEGM NAME=SKILNAME, X PARENT=((SKILMAST,DBLE),(NAMEMAST,P,PAYROLDB)), X BYTES=80,PTR=(LPARNT,LTWINBWD,TWIN) FIELD NAME=(EMPLOYEE,SEQ,U),START=1,BYTES=60,TYPE=C DBDGEN FINISH END

Making changes to the DBDs for physical pairing

To convert a virtually paired logical relationship to physical pairing, the following must be done:

򐂰 Add an LCHILD statement under the parent of the segment that was the real logical child. In Example 8-26 on page 115 this is the SKILMAST segment. In this LCHILD statement do the following:

– The new LCHILD statement must have a NAME parameter that specifies the segment that had the SOURCE parameter. In the example this is NAMESKIL.

– The PAIR parameter must specify the segment that was specified in the SOURCE parameter. This was the real logical child. In the example this is SKILNAME.

򐂰 Find the LCHILD statement that references the segment that was the real logical child. In Example 8-26 on page 115 this is the LCHILD statement in the PAYROLDB database that includes NAME=(SKILNAME,SKILLINV). In this LCHILD statement do the following:

a. Delete the PTR parameter.

b. If there is a RULES parameter, delete it.

򐂰 Find the SEGM statement that defined the virtual logical child. In

Example 8-26 on page 115 this is the NAMESKIL segment. In this SEGM statement make the following changes:

a. Add a BYTES parameter. The lengths of the fixed intersection data in the paired logical children must be the same. The BYTES parameter includes both the fixed intersection data and the logical parent's concatenated key

(LPCK). The BYTES value for this segment may be calculated by taking the BYTES value from the paired logical child's SEGM statement, adding the LPCK size for this segment, and subtracting the LPCK size for the paired logical child. In the example, the paired logical child for the

NAMESKIL segment is the SKILNAME segment. Its size is 80 bytes. The LPCK for the NAMESKIL segment is the TYPE field in the SKILMAST segment. Its size is 21 bytes. The LPCK for the SKILNAME segment is the EMPLOYEE field in the NAMEMAST segment. Its size is 60 bytes. The BYTES parameter for the NAMESKIL segment should be 41, which is 80 + 21 - 60.

b. Delete the SOURCE parameter.

c. Change the PARENT parameter so that it also references its logical parent. In the example this is the SKILMAST segment. The PARENT parameter should also include the PHYSICAL or P keyword.

d. Change the PTR parameter specifications. Include PAIRED. Include TWIN, T, TWINBWD, TB, NOTWIN, or NT. Do not use NOTWIN or NT unless you will have a maximum of only one instance of this segment type under a parent.

򐂰 Find the SEGM statement for segment that was the real logical child. In Example 8-26 on page 115 this is the SKILNAME segment. In this SEGM statement make the following changes:

– Change the PARENT parameter so that neither SNGL nor DBLE is specified. If VIRTUAL or V was specified, change this to PHYSICAL or P. – Change the PTR parameter specifications. Delete LTWIN, LT, LTWINBWD,

or LTB keywords if they exist. Specify both the LPARNT and PAIRED keywords.

Example 8-28 and Example 8-29 on page 118 show the DBDs from

Example 8-26 on page 115 and Example 8-27 on page 116 after they have been converted to HALDBs with physical pairing. In addition to the changes made for logical relationships, other changes for the conversion to HALDB have been made. These are changes in the ACCESS parameter on the DBD statements and deletion of the DATASET statements.

Example 8-28 PHIDAM DBD with a logical relationship

DBD NAME=PAYROLDB,ACCESS=PHIDAM SEGM NAME=NAMEMAST,PTR=TWINBWD,RULES=(VVV), X BYTES=150 LCHILD NAME=(SKILNAME,SKILLINV),PAIR=NAMESKIL FIELD NAME=(EMPLOYEE,SEQ,U),BYTES=60,START=1,TYPE=C SEGM NAME=NAMESKIL, X PARENT=((NAMEMAST),(SKILMAST,P,SKILLINV)), X BYTES=41,PTR=(TWIN,PAIRED)

FIELD NAME=(TYPE,SEQ,U),BYTES=21,START=1,TYPE=C DBDGEN FINISH END

Example 8-29 PHDAM DBD with a logical relationship

DBD NAME=SKILLINV,ACCESS=PHDAM,RMNAME=(DFSHDC40,1,500,824) SEGM NAME=SKILMAST,BYTES=31,PTR=TWINBWD FIELD NAME=(TYPE,SEQ,U),BYTES=21,START=1,TYPE=C LCHILD NAME=(NAMESKIL,PAYROLDB),PAIR=SKILNAME SEGM NAME=SKILNAME, X PARENT=((SKILMAST),(NAMEMAST,P,PAYROLDB)), X BYTES=80,PTR=(TWIN,PAIRED) FIELD NAME=(EMPLOYEE,SEQ,U),START=1,BYTES=60,TYPE=C DBDGEN FINISH END

In document The Complete IMS HALDB Guide (Page 132-136)