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 prior to the root segment. After any read or write, the position is after the segment just processed.

It is important to keep database position when processing a database sequentially. In the sequential processing IMS will go in forward direction only.

If the application program tries to retrieve for segment which has already been passed, IMS will not find the segment. The database position described below for various calls either the call is successful or unsuccessful.

For successful calls -


  • Before any calls are triggered, the position is before the first segment in the database.
  • After GU, GN, and GNP, the position is after the segment just retrieved.
  • After ISRT, the position is after the segment just added.
  • For DLET, the position is after the segment just deleted.
  • After REPL, 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 is after the last segment which satisfied the call.
  • After DLET, and REPL there is no change to 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 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.