IMS DB Realtime (Scenario based) Interview Questions (21 - 30)

21. What is the return code you get after a successful IMS call?

After a successful IMS call, the return code is spaces (or ' ') in the PCB status field. For example - If GU (Get Unique) finds the segment, the PCB status will be blank ( ).

Error Codes:

  • GB = Segment not found
  • GE = End of database

22. Through which segment all dependent segments are accessed?

All dependent segments are accessed through the root segment (the top-level segment in the hierarchy). IMS uses a top-down approach—you must start from the root to navigate to child segments. For example - To access EMPLOYEE (child), you must first access DEPARTMENT (parent).

23. Which is the first statement in COBOL-IMS programs?

The first statement in a COBOL-IMS program is ENTRY 'DLITCBL' USING PCB1 PCB2 ...

  • DLITCBL = Entry point for IMS-COBOL programs.
  • USING PCB1 PCB2 = Specifies the PCBs (Program Communication Blocks) used.

24. What is the difference between a logical unit of work and a physical unit of work?

Logical Unit of Work (LUW)Physical Unit of Work (PUW)
Defined by the programmer (e.g., a transaction like "Transfer Money").Defined by IMS (a single database call like ISRT, REPL).
Can include multiple database calls.A single IMS operation.
Ends with a SYNC (synchronization point).Automatically handled by IMS.

25. What are the processing modes available in IMS DB?

IMS supports three processing modes:

  • GSAM (Generalized Sequential Access Method) Sequential file processing (like flat files).
  • HSAM (Hierarchical Sequential Access Method) Sequential access to IMS databases.
  • HDAM/HISAM (Hierarchical Direct/Indexed Sequential) Direct or indexed access for fast retrieval.

26. Which parameter specifies the language in which the application program is written in PSBGEN?

The LANG=COBOL (or LANG=PL/I, LANG=ASSEMBLY) parameter in PSBGEN specifies the program language. It tells IMS which language the program uses for proper communication.

27. Which is used to pass the control back to the IMS control program?

The GU (Get Unique) or GN (Get Next) call returns control to IMS after fetching data. In COBOL, the GOBACK statement ends the program and returns control to IMS. The PCB (Program Communication Block) handles control transfer.

28. Which function is used to get a unique record for update purpose?

The GHU (Get Hold Unique) call retrieves a segment and locks it for update/delete. It ensures no other program can change the segment while you’re working on it. After GHU, use REPL (Replace) to update or DLET (Delete) to remove the segment.

29. Which function is used to retrieve segment occurrences in sequence subordinate to an established parent segment?

The GN (Get Next) call is used to retrieve segment occurrences sequentially under a parent segment. It follows the hierarchy path after the parent is established. For example - First, use GU to locate the parent (e.g., DEPARTMENT). Then, use GN to fetch all child segments (e.g., EMPLOYEE records) one by one.

30. What is the predefined pattern for sequential processing?

The predefined pattern is GU → GN → GN → ...:

  • GU (Get Unique): Finds the starting segment.
  • GN (Get Next): Retrieves subsequent segments in sequence.