IMS DB: Quick Tutorial on GU and GHU calls

Top differences between GU and GHU calls of IMS DB explained here for your reference.

GU CALL

GU CALL-Used to retrieve a specific segment occurrence independent of the current position within the database Qualified SSAs identifying each hierarchical level are normally provided.

A GET UNIQUE call with missing levels of qualification uses current control block information for missing levels. If none exist, unqualified SSAs are assumed for the missing levels.

A GET UNIQUE call always returns the first segment in the database that satisfies the qualification.

STATUS CODES:
‘GE’ – Segment not found
‘bb’ – Successful call

GHU CALL

Get Hold callReplace and Delete Call-Function Code: ‘REPL ‘ and ‘DLET’. Used to replace and delete the specified segment

Read With Hold is necessary before you work on with these calls.

GHU, GHN, GHNP.

Advertisements

While replacing, key portion cannot be modified. For delete call do not move anything into segment area.

GHU  EMPSEG (EMPNO=123456)
DLET
(here no need to specify qualification)

REPL & DLET must be preceded by HOLD call. Otherwise IMS will give you the return code ‘DA’, ‘DJ’.

Other way of using DLET command

GHU       EMPSEG(EMPNO=123456)
GHN       PRSEG---*L  => go for last PRSEG
                  *F  =>go for first PRSEG
DLET

 * indicates Command Code Follows

 -,-,-Three spaces

Also Read

Author: Srini

Experienced Data Engineer, having skills in PySpark, Databricks, Python SQL, AWS, Linux, and Mainframe