Quiz — Chapter 31: IMS/DB Basics
Multiple Choice
1. What is the basic unit of data in an IMS database? - a) Row - b) Record - c) Segment - d) Block
2. Which DL/I call retrieves a specific segment by navigating directly to it using qualified SSAs? - a) GN (Get Next) - b) GNP (Get Next within Parent) - c) GU (Get Unique) - d) GHN (Get Hold Next)
3. What must you do before issuing a REPL (Replace) call? - a) Issue a GU call for the segment - b) Issue a hold call (GHU, GHN, or GHNP) for the segment - c) Issue an ISRT call first - d) Lock the database explicitly
4. What does the status code "GE" indicate after a DL/I call? - a) General error - b) Segment not found (or end of search) - c) Good execution - d) Get error
5. What is the purpose of a PSB (Program Specification Block)? - a) To define the physical structure of the database - b) To specify which databases and segments a program can access - c) To store program source code - d) To manage database backups
6. In hierarchical sequence, how does IMS traverse a database record? - a) Breadth-first, left-to-right - b) Top-down, right-to-left, depth-first - c) Top-down, left-to-right, depth-first - d) Random access based on hash
7. Which IMS access method uses a randomizing module (hash) for root segment access? - a) HSAM - b) HISAM - c) HDAM - d) HIDAM
8. What does the D command code in an SSA do? - a) Delete the segment - b) Retrieve multiple segments in a path with a single call - c) Disable locking - d) Debug the DL/I call
9. What happens when you issue a DLET call on a parent segment? - a) Only the parent segment is deleted - b) The parent and all its dependent (child) segments are deleted - c) The parent is marked for deletion but not removed - d) An error occurs — you cannot delete parents
10. Which IMS region type is used for high-volume online transactions with the fastest response times? - a) Batch DL/I - b) BMP (Batch Message Processing) - c) MPP (Message Processing Program) - d) IFP (IMS Fast Path)
True/False
11. IMS was originally developed for the Apollo space program. True / False
12. In IMS, a GN call always returns the same segment type. True / False
13. The PCB status code should be checked after every DL/I call. True / False
14. Logical databases allow you to create virtual views combining segments from multiple physical databases. True / False
15. The CHKP (Checkpoint) call in IMS is equivalent to COMMIT in DB2. True / False
Short Answer
16. Explain the difference between a qualified SSA and an unqualified SSA. Give an example of when you would use each.
17. What is the difference between GN and GNP? In what scenario would you use GNP instead of GN?
18. Describe the GA and GK status codes. Are they errors? How should a program handle them?
19. Name three ways that modern applications can access IMS databases without using traditional DL/I calls from COBOL.
20. A COBOL program issues a GN call and gets status code spaces (success), but the I/O area contains data from a different segment type than expected. What likely happened, and how should the program handle it?
Answer Key
- c — Segment is the basic unit of data in IMS.
- c — GU (Get Unique) navigates directly using qualified SSAs.
- b — A hold call (GHU, GHN, or GHNP) is required before REPL or DLET.
- b — GE means segment not found or end of search.
- b — The PSB specifies which databases and segments a program can access.
- c — IMS traverses top-down, left-to-right, depth-first.
- c — HDAM uses a randomizing module for root segments.
- b — The D command code retrieves multiple segments in a path.
- b — DLET cascades, removing the parent and all dependents.
- d — IFP (IMS Fast Path) handles the highest-volume, lowest-latency transactions.
- True — IMS development began in 1966 for the Saturn V bill of materials.
- False — GN returns the next segment in hierarchical sequence, which may be any type.
- True — Failing to check the status code is the most common IMS programming error.
- True — Logical databases create virtual views across physical databases.
- True — CHKP is the IMS equivalent of a sync point / commit.
- An unqualified SSA names a segment type without selection criteria (e.g., "any ACCOUNT"). A qualified SSA includes a condition (e.g., "ACCOUNT where ACCT-NUM = '12345'"). Use unqualified when iterating through all occurrences; use qualified when you need a specific occurrence.
- GN returns the next segment in the entire database in hierarchical sequence. GNP returns the next segment only within the current parent. Use GNP when processing all children of a specific parent (e.g., all accounts for one customer) to avoid accidentally reading into the next customer's data.
- GA means the returned segment is under a different parent than the previous one. GK means the returned segment is a different type but under the same parent. They are not errors — IMS successfully retrieved a segment. Programs should treat them as informational signals for detecting boundaries.
- (1) IMS Connect for TCP/IP access, (2) IMS Universal JDBC driver for Java SQL-like access, (3) z/OS Connect Enterprise Edition for RESTful API access.
- IMS returned the next segment in hierarchical sequence, which happened to be a different type. The program should check PCB-SEG-NAME to identify the segment type and process accordingly, or use a qualified SSA to restrict retrieval to only the desired segment type.