Assuming an application that uses the CUSTOMER database, requires direct access to receivable segments based on adjustment date of ADJSTMNT segment.
For this example the Source Segment is ADJSTMNT segment and the Target segment is RECVABLE segment. Like in the previous example, the structure of the database is changed because of secondary index.
The CUSTDBD needs to be defined as shown below.
PRINT NOGEN DBD NAME=CUSTDBD4,ACCESS=HIDAM DATASET DD1=CUST4,DEVICE=3350 SEGM NAME=CUSTOMER,PARENT=0,BYTES=128 FIELD NAME=(CUSTNUM,SEQ,U),BYTES=6,START=1,TYPE=C FIELD NAME=CUSTNAME,BYTES=31,START=7,TYPE=C .......... SEGM NAME=RECVABLE,PARENT=SHIPTO,BYTES=57 FIELD NAME=(RSINVNUM,SEQ,U),BYTES=6,START=1,TYPE=C LCHILD NAME=(XRECVBL2,XCSTDBD4),POINTER=INDX XDFLD NAME=XADJDATE,SEARCH=AADJDATE FIELD NAME=RSINDATE,BYTES=6,START=7,TYPE=C FIELD NAME=RSPONUM,BYTES=25,START=13,TYPE=C FIELD NAME=RSPRDTOT,BYTES=4,START=38,TYPE=P .......... DBDGEN FINISH END |
The DBD for Secondary Index is as follows:
PRINT NOGEN DBD NAME=XCSTDBD4,ACCESS=INDEX DATASET DD1=XCUST4,DEVICE=3350 SEGM NAME=XRECVBL2,PARENT=0,BYTES=57 FIELD NAME=(AADJDATE,SEQ),BYTES=6,START=1,TYPE=C LCHILD NAME=(RECVABLE,CUSTDBD4),INDEX=XADJDATE DBDGEN FINISH END |
The PSB required for this example is:
PRINT NOGEN PCB TYPE=DB,DBDNAME=CUSTDBD4,KEYLEN=30,PROCOPT=L, PROCSEQ=XCSTDBD4 SENSEG NAME=RECVABLE SENSEG NAME=SHIPTO,PARENT=RECVABLE SENSEG NAME=CUSTOMER,PARENT=SHIPTO SENSEG NAME=BUYER,PARENT=SHIPTO SENSEG NAME=PAYMENT,PARENT=RECVABLE SENSEG NAME=ADJSTMNT,PARENT=RECVABLE SENSEG NAME=LINEITEM,PARENT=RECVABLE PSBGEN PSBNAME=CUSTPSB4,LANG=COBOL |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!