I am coding COBOL-IMS DBIO Programs to get my hands wet. The snapshot below, shows the DBD Database Structure of the IMS Database.
DBD Database Structure :
Data Stored :
001 INDUS CHEMICALS PETERS ROAD,ROYAPETTAH CHENNAI TN 600001 4466004332 8097415095
00011 SODIUM, PALMITATE 15500.00 4600.00
DEL 1500 300 450 160204
MUM 1000 200 400 230510
00012 METHYL ORANGE 17255.00 3230.00
CHN 1750 350 650 140106
002 AMAR PHARMACEUTICALS CARTER ROAD,BANDRA MUMBAI MH 400103 2228941365 9821065010
00021 ACETIC ACID 10500.00 4600.00
BAN 2500 350 850 120507
GUR 2750 950 685 170306
KOL 3600 550 900 050301
00022 TINCTURE IODINE 12500.00 6800.00
00011 SODIUM, PALMITATE 15500.00 4600.00
DEL 1500 300 450 160204
MUM 1000 200 400 230510
00012 METHYL ORANGE 17255.00 3230.00
CHN 1750 350 650 140106
002 AMAR PHARMACEUTICALS CARTER ROAD,BANDRA MUMBAI MH 400103 2228941365 9821065010
00021 ACETIC ACID 10500.00 4600.00
BAN 2500 350 850 120507
GUR 2750 950 685 170306
KOL 3600 550 900 050301
00022 TINCTURE IODINE 12500.00 6800.00
Note : The Level of indentation corresponds to the level in the IMS-DB Hierarchical Structure. First level-of-indentation : VENDRSEG Segment, Second Level-of-Indentation : ITEMSSEG, Third Level-of-indentation : STLOCSEG
Problem : I have coded a COBOL Program that PERFORMs the Following Tasks :
1. 520-ESTABLISH-PARENTAGE at the VENDOR Segment, By Executing the following CALL
MOVE 'VENDRSEG*- ' TO UNQUALIFIED-SSA
CALL 'CBLTDLI' USING DLI-GN
INVENTORY-PCB-MASK
INVENTORY-VENDOR-SEGMENT
UNQUALIFIED-SSA
CALL 'CBLTDLI' USING DLI-GN
INVENTORY-PCB-MASK
INVENTORY-VENDOR-SEGMENT
UNQUALIFIED-SSA
After the CALL was executed, the PCB Storage Area dump was,
PCB DUMP :
* * * * * * PCB STORAGE DUMP * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 01
IMS STATUS CODE :
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : VENDRSEG
KEY OF THE LAST VISITED DATA : 001
LAST VISITED DATA KEY LENGTH : 00003
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 01
IMS STATUS CODE :
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : VENDRSEG
KEY OF THE LAST VISITED DATA : 001
LAST VISITED DATA KEY LENGTH : 00003
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
2. 550-GOTO-LAST-LOCATION traverses through the STOCK-LOCATION Segment Occurrences, UNTIL STATUS-CODE='GE'.
MOVE 'STLOCSEG*- ' TO UNQUALIFIED-SSA
PERFORM UNTIL SEGMENT-OCCURRENCE-NOT-FND
*----------------------------------------------------------------*
CALL 'CBLTDLI' USING DLI-GNP
INVENTORY-PCB-MASK
INVENTORY-STOCK-LOC-SEGMENT
UNQUALIFIED-SSA
*----------------------------------------------------------------*
MOVE IPCB-STATUS-CODE TO DLI-STATUS-CODE
END-PERFORM
PERFORM UNTIL SEGMENT-OCCURRENCE-NOT-FND
*----------------------------------------------------------------*
CALL 'CBLTDLI' USING DLI-GNP
INVENTORY-PCB-MASK
INVENTORY-STOCK-LOC-SEGMENT
UNQUALIFIED-SSA
*----------------------------------------------------------------*
MOVE IPCB-STATUS-CODE TO DLI-STATUS-CODE
END-PERFORM
After the PERFORM Block was executed, the PCB Storage Area dump was,
PCB DUMP :
* * * * * * PCB STORAGE DUMP * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 02
IMS STATUS CODE : GE
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : ITEMSSEG
KEY OF THE LAST VISITED DATA : 00100012CHN
LAST VISITED DATA KEY LENGTH : 00008
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 02
IMS STATUS CODE : GE
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : ITEMSSEG
KEY OF THE LAST VISITED DATA : 00100012CHN
LAST VISITED DATA KEY LENGTH : 00008
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
3. 570-RESET-POSITION SHOULD reset the Database Position, back to square one - the First STOCK LOCATION Segment Occurrence, by executing a GNP CALL, with Command-Code F.
MOVE 'STLOCSEG*F ' TO UNQUALIFIED-SSA
*----------------------------------------------------------------*
CALL 'CBLTDLI' USING DLI-GNP
INVENTORY-PCB-MASK
INVENTORY-STOCK-LOC-SEGMENT
UNQUALIFIED-SSA
*----------------------------------------------------------------*
*----------------------------------------------------------------*
CALL 'CBLTDLI' USING DLI-GNP
INVENTORY-PCB-MASK
INVENTORY-STOCK-LOC-SEGMENT
UNQUALIFIED-SSA
*----------------------------------------------------------------*
After the GNP CALL with F Command-code was executed, the PCB Storage Area dump was,
PCB DUMP :
* * * * * * PCB STORAGE DUMP * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 03
IMS STATUS CODE :
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : STLOCSEG
KEY OF THE LAST VISITED DATA : 00100012CHN
LAST VISITED DATA KEY LENGTH : 00011
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
DBD NAME : INVDBD
LAST SEGMENT LEVEL : 03
IMS STATUS CODE :
PROCESSING OPTIONS : G
LAST VISITED SEGMENT : STLOCSEG
KEY OF THE LAST VISITED DATA : 00100012CHN
LAST VISITED DATA KEY LENGTH : 00011
SEGMENT SENSITIVITY : 00003
* * * * * * * * * * * * * * * * * * * * *
When I print the contents of the Segment IO-Area, it displays the INCORRECT Output.
LOCATION : CHN
ON HAND : 0001750
REORD PT : 0000350
ON ORDER : 0000650
REORDER DT:140106
ON HAND : 0001750
REORD PT : 0000350
ON ORDER : 0000650
REORDER DT:140106
The correct and expected Output after resetting the Database-Pointer to the FIRST Stock-Location under the established Parent, should be 'DEL 1500 300 450 160204'.
Attached herewith, please find 1) Program Source-Code 2) Compile-Listing with the expanded Copy-books and 3) Output-Listing obtained after running the Program. Kindly advise, as to what changes should I make, to get the Expected Result.
Thank you very much.