Defining DBD statements for the PSINDEX
Attributes of the PSINDEX master database are defined by using the DBD statements.
Define the following DBD statements for the PSINDEX:
- DBD statement
Specify ACCESS=PSINDEX to identify this database as a HALDB partitioned secondary index.
- SEGM statement
- LCHILD statement
You must specify the RKSIZE parameter for a PSINDEX.
If you used symbolic pointers in your non-HALDB secondary index, you must change the PTR=SYMB specification in the indexed database DBD to PTR=INDX and either omit the PTR parameter in the secondary index DBD or specify PTR=SNGL in it.
- XDFLD statement
- FIELD statement
If you use non-unique keys in your existing secondary index, you can use the /SX field to create unique keys in your PSINDEX. HALDB PSINDEXes require unique keys.
You must change the DBDs for your secondary index databases before they are loaded as HALDB secondary indexes. You might also need to change the DBDs of some of your indexed databases.
Removing symbolic pointers
If you use symbolic pointers, you must remove them, because HALDB secondary indexes do not support symbolic pointers.
Symbolic pointers are defined with a PTR=SYMB parameter on the LCHILD statements in the non-HALDB secondary index and the indexed database DBDs. You must change the PTR=SYMB specification in the indexed database DBD to PTR=INDX and either omit the PTR parameter in the secondary index DBD or specify PTR=SNGL in it.
- The non-HALDB secondary index DBD with symbolic pointing defined.
- The indexed HDAM DBD.
- The secondary index DBD after it has been converted to HALDB.
- The indexed database DBD after it has been converted to HALDB.
The following figure shows the non-HALDB secondary index DBD with symbolic pointing defined.
DBD NAME=CONTRSI,ACCESS=INDEX
DATASET DD1=CONTSI,DEVICE=3390,SIZE=8192
SEGM NAME=CONTR,BYTES=26,PARENT=0
FIELD NAME=(CONTRNUM,SEQ,U),BYTES=8,START=1,TYPE=C
LCHILD NAME=(CONTRACT,ENGAGEM),INDEX=CONTRIDX,PTR=SYMB
DBDGEN
FINISH
END
The following figure shows the indexed HDAM DBD.
DBD NAME=ENGAGEM,ACCESS=HDAM,RMNAME=(DFSHDC40,1,500,824)
DATASET DD1=ENGAHDAM,BLOCK=1648,SCAN=0
SEGM NAME=CLIENT,BYTES=100,PTR=TWIN
FIELD NAME=(CLNUM,SEQ,U),BYTES=10,START=1,TYPE=C
SEGM NAME=CONTRACT,PARENT=CLIENT,BYTES=60,PTR=TWIN
FIELD NAME=(CONTRNO,SEQ,U),BYTES=8,START=1,TYPE=C
LCHILD NAME=(CONTR,CONTRSI),PTR=SYMB
XDFLD NAME=CONTRIDX,SRCH=CONTRNO
DBDGEN
FINISH
END
The following figure shows the secondary index DBD after it has been converted to HALDB. PTR=SYMB is deleted from the LCHILD statement. RKSIZE is added to it. Symbolic pointers are stored in the data area of index segments. Because it is not in the HALDB secondary index, the BYTES parameter on the SEGM segment is reduced by the size of the symbolic pointer.
DBD NAME=CONTRSI,ACCESS=PSINDEX
SEGM NAME=CONTR,BYTES=8,PARENT=0
FIELD NAME=(CONTRNUM,SEQ,U),BYTES=8,START=1,TYPE=C
LCHILD NAME=(CONTRACT,ENGAGEM),INDEX=CONTRIDX,RKSIZE=10
DBDGEN
FINISH
END
The following figure shows the indexed database DBD after it has been converted to HALDB. PTR=INDX is specified on the LCHILD segment for the secondary index relationship.
DBD NAME=ENGAGEM,ACCESS=PHDAM,RMNAME=(DFSHDC40,1,500,824)
SEGM NAME=CLIENT,BYTES=100,PTR=TWIN
FIELD NAME=(CLNUM,SEQ,U),BYTES=10,START=1,TYPE=C
SEGM NAME=CONTRACT,PARENT=CLIENT,BYTES=60,PTR=TWIN
FIELD NAME=(CONTRNO,SEQ,U),BYTES=8,START=1,TYPE=C
LCHILD NAME=(CONTR,CONTRSI),PTR=INDX
XDFLD NAME=CONTRIDX,SRCH=CONTRNO
DBDGEN
FINISH
END
If you have applications that process a secondary index by using symbolic pointers as a database, you will need to make other changes to your DBDs.
Converting non-unique secondary index keys to unique keys
HALDB secondary indexes must have unique keys.
If your secondary indexes use non-unique keys, complete the following steps to convert them to unique keys:
- Add a subsequence field by adding the /SX system-related field to the XDFLD statement in the indexed database DBD. This field adds 8 bytes to the length of the sequence field in the index. In the examples, the BYTES parameter in the FIELD statement is increased by 8 bytes for this conversion.
- On the FIELD statement, change the value of the third subparameter from M to U on the NAME parameter. The U parameter indicates that only unique values are allowed in the sequence field of the segment.
The following example shows a non-HALDB secondary index DBD with non-unique keys.
DBD NAME=XSI3,ACCESS=INDEX
DATASET DD1=XSI301,OVFLW=XSI302
SEGM NAME=XSNAM,BYTES=6,PARENT=0
FIELD NAME=(XSNAME,SEQ,M),START=1,BYTES=6
LCHILD NAME=(PERF,XPER01),INDEX=NAMX1,POINTER=SNGL
DBDGEN
FINISH
END
The following figure shows the DBD for the secondary index after it has been converted to HALDB.
DBD NAME=XSI3,ACCESS=PSINDEX
SEGM NAME=XSNAM,BYTES=14,PARENT=0
FIELD NAME=(XSNAME,SEQ,U),START=1,BYTES=14
LCHILD NAME=(PERF,XPER01),INDEX=NAMX1,POINTER=SNGL,RKSIZE=12
DBDGEN
FINISH
END
Modifying the PSINDEX DBD for the larger HALDB /SX field
If you already use a /SX field to create unique keys for the secondary index you are converting to HALDB, increase the BYTES parameter on both the SEGM statement and the FIELD statement by 4 bytes. In non-HALDB secondary indexes, a /SX field contains a 4-byte RBA. In a HALDB secondary index, a /SX field contains an 8-byte ILK.
You do not need to change the XDFLD statement or the /SX FIELD statement in the indexed DBD. The BYTES parameter on the /SX FIELD statement is not required and is ignored if it is specified.
The following example shows the DBD for an indexed HDAM database with a /SX field defined.
DBD NAME=VEHICLE,ACCESS=(HDAM,OSAM), X
RMNAME=(DFSHDC40,2,500,)
DATASET DD1=VEHICLE1,BLOCK=1648,SCAN=0
SEGM NAME=AUTO,BYTES=54,PTR=TB
FIELD NAME=(ID,SEQ,U),BYTES=10,START=1
FIELD NAME=MAKE,BYTES=20,START=11
FIELD NAME=MODEL,BYTES=20,START=31
FIELD NAME=YEAR,BYTES=4,START=51
FIELD NAME=/SX1
LCHILD NAME=(MAKEMOD,VEHSI),PTR=INDX
XDFLD NAME=MMIDX,SRCH=(MAKE,MODEL),SUBSEQ=/SX1
DBDGEN
FINISH
END
The following example shows the DBD for a non-HALDB secondary index that uses the /SX field that is defined in the preceding figure.
DBD NAME=VEHSI,ACCESS=INDEX
DATASET DD1=VEHSI1,DEVICE=3390,SIZE=8192
SEGM NAME=MAKEMOD,BYTES=44,PARENT=0
FIELD NAME=(NAMES,SEQ,U),BYTES=44,START=1
LCHILD NAME=(AUTO,VEHICLE),INDEX=MMIDX
DBDGEN
FINISH
END
The following example shows the DBD from Figure 7 after it has been converted to HALDB. The only changes are those made for all HDAM DBDs when they are converted to PHDAM. That is, the ACCESS parameter on the DBD STATEMENT is changed to PHDAM and the DATASET statement is deleted.
DBD NAME=VEHICLE,ACCESS=(PHDAM,OSAM), X
RMNAME=(DFSHDC40,2,500,)
SEGM NAME=AUTO,BYTES=54,PTR=TB
FIELD NAME=(ID,SEQ,U),BYTES=10,START=1
FIELD NAME=MAKE,BYTES=20,START=11
FIELD NAME=MODEL,BYTES=20,START=31
FIELD NAME=YEAR,BYTES=4,START=51
FIELD NAME=/SX1
LCHILD NAME=(MAKEMOD,VEHSI),PTR=INDX
XDFLD NAME=MMIDX,SRCH=(MAKE,MODEL),SUBSEQ=/SX1
DBDGEN
FINISH
END
The following example shows the DBD from Figure 8 after it has been converted to HALDB. As with other secondary index DBD conversions, the ACCESS parameter on the DBD statement is changed to PSINDEX, the DATASET statement is deleted, and the RKSIZE parameter is added to the LCHILD statement. Because the /SX field is used as a subsequence field, the BYTES parameters on the SEGM and FIELD statements are increased by four.
DBD NAME=VEHSI,ACCESS=PSINDEX
SEGM NAME=MAKEMOD,BYTES=48,PARENT=0
FIELD NAME=(NAMES,SEQ,U),BYTES=48,START=1
LCHILD NAME=(AUTO,VEHICLE),INDEX=MMIDX,RKSIZE=10
DBDGEN
FINISH
END