IMS DB Database positions
The sequential processing of an IMS Hierarchy is always from top-to-bottom and left-to-right. IMS keeps track of its place in the database after every DL/I call.
Before the first call to IMS, the position is before the root segment. After any read or write, the position is after the segment has just been processed.
It is important to keep the database position when processing a database sequentially. In sequential processing, IMS will go in the forward direction only.
If the application program tries to retrieve a segment that has already passed, IMS will not find the segment. The database position for various successful or unsuccessful calls is described below -
For successful calls -
- Before any calls are triggered, the position is before the first segment in the database.
- After the GU, GN, and GNP call, the position is after the retrieved segment.
- After the ISRT call, the position is after the segment just added.
- For the DLET call, the position is after the segment just deleted.
- After the REPL call, there was no change to position.
- After CHKP, the position is back to the beginning of the database.
For unsuccessful calls -
- After GU, GN, GNP, and ISRT, the position was after the last segment, which satisfied the call.
- After DLET and REPL, there has been no change to the position.
Multiple Database Positioning -
Multiple database positioning can be accomplished in the below two ways -
- Defining multiple PCBs for the same database and IMS maintains its position for each PCB.
- Defining a PCB with a multi-positioning option and IMS maintains several positions in the one database in different paths.
The first option is most preferable for multiple database positioning.