Vous êtes sur la page 1sur 6

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.

RKSIZE=
Specifies the root key size of the target database. This parameter is required for
partitioned secondary index (PSINDEX) databases only, and is invalid for any other
database type.

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 examples in the following series of figures illustrate the changes you need to make to
remove symbolic pointers from the DBD statements. The DBD statements involved are:
 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.

Example: DBD for secondary index that uses symbolic pointing


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

Figure 3. Example: DBD for HALDB secondary index


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 root key size of the target database
DBD NAME=ENGAGEM FIELD
NAME=(CLNUM,SEQ,U),BYTES= 10,START=1,TYPE=C
The following figure shows the indexed HDAM DBD.

Example: DBD for indexed database with symbolic pointing


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 indexed database DBD after it has been converted to HALDB.
PTR=INDX is specified on the LCHILD segment for the secondary index relationship.

Example: DBD for HALDB indexed database


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:

1. 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.
2. 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.

Figure 5. Example: 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.

Figure 6. Example: HALDB secondary index DBD with unique keys


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

Vous aimerez peut-être aussi