Key Takeaways — Chapter 31: IMS/DB Basics

Core Concepts

  1. IMS organizes data hierarchically — segments in parent-child trees, not rows in flat tables. Understanding the hierarchy is prerequisite to writing correct DL/I calls.

  2. DL/I is navigational, not declarative — you tell IMS how to traverse the hierarchy, one segment at a time, unlike SQL where you describe what you want and the optimizer figures out how.

  3. Six retrieval calls, three update calls — GU, GN, GNP (and their hold variants GHU, GHN, GHNP) for retrieval; ISRT, REPL, DLET for updates. Hold calls are required before REPL or DLET.

  4. SSAs control navigation — unqualified SSAs accept any segment; qualified SSAs specify selection criteria; command codes (D, F, L, P, U) provide advanced navigation.

  5. Always check the PCB status code — spaces means success, GE means not found. Processing stale data from a previous call's I/O area is the most common IMS bug.

Practical Guidelines

  • Every DL/I call gets an EVALUATE — check for spaces (success), GE (not found), and OTHER (unexpected error).
  • Use qualified SSAs whenever possible — they let IMS navigate directly instead of scanning.
  • Use the D command code to retrieve multiple segments in a path with a single call.
  • Minimize DL/I call count — each call has overhead; call count is the primary performance driver.
  • Understand the hierarchy before coding — study the DBD to understand the data model and business relationships.
  • IMS is not obsolete — it processes billions of transactions daily and continues to evolve with TCP/IP, REST, and Java access.

Common Pitfalls

  • Forgetting to check GE status after GN/GNP calls
  • Using unqualified SSAs when qualified SSAs would be far more efficient
  • Attempting REPL or DLET without a preceding hold call
  • Not understanding cascading DLET — deleting a parent removes all descendants
  • Group-moving data into the I/O area instead of field-level moves
  • Assuming sequential processing order without understanding hierarchical sequence

Connections

  • Chapter 28 (DB2 Basics): Contrasts SQL's set-based approach with DL/I's navigational approach
  • Chapter 32 (Transaction Design Patterns): IMS checkpoint/rollback is the IMS equivalent of DB2 COMMIT/ROLLBACK
  • Chapter 37 (Modernization Strategies): IMS modernization patterns (wrapping, bridging, migration)