Chapter 26 Quiz: IMS Database and Transaction Management

Test your knowledge of IMS hierarchical databases, DL/I programming, PCB/PSB concepts, segment search arguments, and IMS Transaction Manager. Answers are hidden behind expandable sections.


Question 1 — Multiple Choice

Which DL/I function code retrieves the next segment in hierarchical sequence regardless of segment type?

A. GU B. GN C. GNP D. GHN

Answer **B. GN (Get Next)** GN retrieves the next segment in the hierarchical sequence of the database, regardless of segment type. GU retrieves a specific segment directly. GNP gets the next segment only within the current parent. GHN does the same as GN but also establishes a hold for subsequent update or delete.

Question 2 — True/False

A REPL (Replace) call can be issued immediately after a GU (Get Unique) call without any special options.

Answer **False.** A REPL call requires a prior hold call (GHU, GHN, or GHNP). Issuing REPL after a GU (without the hold variant) will result in status code 'AI' because IMS requires the program to declare update intent by using a hold function.

Question 3 — Fill in the Blank

The IMS control block that defines a program's view of one or more databases is called a __.

Answer **PSB (Program Specification Block)** A PSB defines the complete set of databases a program can access, containing one or more PCBs (Program Communication Blocks), each representing the program's view of a single database or the IMS message queue (TP PCB).

Question 4 — Multiple Choice

What does the status code 'GE' indicate after a DL/I call?

A. A general error occurred in the database. B. The segment was not found or no more segments exist in the requested path. C. A get operation was executed successfully. D. A segment was found but with a data integrity error.

Answer **B. The segment was not found or no more segments exist in the requested path.** 'GE' (segment not found) is a normal condition that indicates the requested segment does not exist (for GU calls) or that there are no more segments matching the criteria (for GN and GNP calls). Programs should handle 'GE' as a normal end-of-data condition, not as an error.

Question 5 — Short Answer

Explain the difference between a qualified SSA and an unqualified SSA. Provide an example of each for a segment named ACCOUNT.

Answer An **unqualified SSA** specifies only the segment name, telling IMS which segment type to operate on without filtering by field values:
ACCOUNT
(The segment name is left-justified and padded to 8 bytes, followed by a blank in position 9.) A **qualified SSA** adds a selection criterion that filters segments by a specific field value:
ACCOUNT (ACCTNO   = 1001000123)
(The segment name is followed by an opening parenthesis, field name padded to 8 bytes, a two-byte relational operator, the comparison value, and a closing parenthesis.) Unqualified SSAs retrieve the first or next occurrence; qualified SSAs retrieve a specific occurrence matching the criteria.

Question 6 — Multiple Choice

In a COBOL-IMS program, the DL/I call interface routine is invoked using:

A. EXEC DLI ... END-EXEC B. CALL 'CBLTDLI' USING ... C. EXEC IMS ... END-EXEC D. Both A and B are valid

Answer **D. Both A and B are valid.** COBOL programs can invoke DL/I calls using either the `CALL 'CBLTDLI'` interface (the traditional approach) or the `EXEC DLI ... END-EXEC` interface (the higher-level approach similar to embedded SQL). Both accomplish the same purpose, though `CALL 'CBLTDLI'` is more common in existing production code.

Question 7 — True/False

The root segment in an IMS hierarchical database can have multiple parent segments.

Answer **False.** The root segment is, by definition, the topmost segment in the hierarchy and has no parent. An IMS database has exactly one root segment type. All other segments are descendants of the root. (Logical relationships can create apparent multi-parent structures, but physically each segment has one parent in its own database.)

Question 8 — Fill in the Blank

The DL/I function code used to add a new segment occurrence to the database is __.

Answer **ISRT (Insert)** ISRT inserts a new segment occurrence into the database. The program must first establish position on the parent segment (for non-root segments), populate the I/O area with the new segment data, and provide the appropriate SSAs to indicate where the new segment should be placed in the hierarchy.

Question 9 — Multiple Choice

Which IMS access method provides both direct access by key and sequential access in key sequence?

A. HSAM B. HISAM C. HDAM D. HIDAM

Answer **D. HIDAM (Hierarchical Indexed Direct Access Method)** HIDAM maintains both a direct access path through a primary index and the ability to process segments in key sequence. HDAM provides fast direct access but no guaranteed sequential key ordering. HISAM supports sequential access efficiently but is less optimal for heavy direct access. HSAM is purely sequential.

Question 10 — Short Answer

What is the purpose of the CHKP (Checkpoint) call in an IMS batch program, and how does it relate to database recovery?

Answer The CHKP call serves two purposes: 1. **Commit point:** It commits all database changes made since the last checkpoint (or program start), making them permanent. Any uncommitted changes will be backed out during recovery. 2. **Recovery point:** It writes a checkpoint record to the IMS log, establishing a restart point. If the program fails, the IMS Batch Backout utility can undo changes made after the last checkpoint, and the program can be restarted from that point using the IMS Restart facility. For extended checkpoint/restart, the program can also save application working data (counters, file positions, etc.) on the CHKP call and restore them on restart using the XRST (Extended Restart) call.

Question 11 — Multiple Choice

What is the maximum number of levels (depth) allowed in an IMS hierarchical database?

A. 5 B. 10 C. 15 D. 255

Answer **C. 15** IMS supports a maximum of 15 levels in a hierarchical database. The root segment is level 1, and the deepest dependent segment can be at level 15. Each level can have up to 255 segment types, with a maximum of 255 segment types per database.

Question 12 — True/False

An IMS MPP (Message Processing Program) processes one input message per invocation and then returns control to IMS for the next message.

Answer **False.** An MPP typically processes multiple messages in a single invocation. The MPP issues GU calls to the TP PCB in a loop, processing each incoming message until IMS returns status code 'QC' (no more messages in the queue), at which point the program terminates. Processing one message per invocation would be inefficient due to program loading overhead.

Question 13 — Fill in the Blank

In the IMS ENTRY statement for a COBOL program, ENTRY 'DLITCBL' USING ________ specifies the list of PCB address pointers that IMS passes to the program.

Answer **the PCB masks (e.g., TP-PCB-MASK, DB-PCB-MASK-1, DB-PCB-MASK-2)** The ENTRY statement receives pointers to the PCBs defined in the program's PSB. The PCB masks are defined in the LINKAGE SECTION and must appear in the ENTRY USING clause in the same order as they are defined in the PSB. For example:
ENTRY 'DLITCBL' USING TP-PCB-MASK
                      BANKDB-PCB-MASK
                      AUDITDB-PCB-MASK.

Question 14 — Multiple Choice

Which of the following is NOT a valid PCB PROCOPT value?

A. G (Get/Read) B. I (Insert) C. U (Update) D. D (Delete) E. A (All)

Answer **C. U (Update)** There is no PROCOPT value 'U'. The correct value for update operations is **R (Replace)**. Valid PROCOPT values are: G (get), R (replace), I (insert), D (delete), A (all), and combinations thereof (e.g., GIR for get, insert, and replace). 'U' is not a recognized PROCOPT option.

Question 15 — Short Answer

Describe the difference between a BMP (Batch Message Processing) region and a standard batch region in IMS. When would you choose BMP over batch?

Answer A **standard IMS batch** program runs outside the IMS online control region. It has exclusive access to its databases, meaning those databases are unavailable to online transactions while the batch program runs. It uses the DL/I batch interface and is not connected to the IMS message queue. A **BMP (Batch Message Processing)** program runs within the IMS online control region. It shares database access with online MPP programs through normal IMS locking and scheduling. A BMP can also optionally read from the IMS message queue (message-driven BMP). Choose BMP over batch when: - The databases must remain available for online transactions during batch processing. - The batch program needs access to the IMS message queue. - You need IMS locking and synchronization with online programs. - You want to avoid taking databases offline for batch windows.

Question 16 — True/False

The D (path) command code in a qualified SSA causes IMS to return data from all segments along the hierarchical path in a single DL/I call.

Answer **True.** The `D` command code enables a path call, where IMS returns the data for multiple segments in the hierarchical path in a single call. Each segment's data is placed in its respective I/O area. This reduces the number of DL/I calls required when data from multiple levels is needed, improving performance.

Question 17 — Fill in the Blank

When an IMS MPP issues a GU call to the TP PCB and receives status code '__', it means there are no more messages to process and the program should terminate.

Answer **QC** Status code 'QC' (Queue Empty) on the TP PCB indicates that there are no more messages available for this transaction code. The MPP should terminate normally when it receives this status code.

Question 18 — Multiple Choice

In the IMS hierarchy CUSTOMER -> ACCOUNT -> TRANSACTION, a GNP call with an unqualified SSA for TRANSACTION issued after positioning on a specific ACCOUNT segment will:

A. Retrieve the next TRANSACTION segment in the entire database. B. Retrieve the next TRANSACTION segment under the current ACCOUNT only. C. Retrieve the next ACCOUNT segment. D. Return status code 'GE' immediately.

Answer **B. Retrieve the next TRANSACTION segment under the current ACCOUNT only.** GNP (Get Next within Parent) restricts retrieval to segments that are dependents of the currently established parent. After positioning on a specific ACCOUNT segment (which becomes the parent), GNP with an unqualified SSA for TRANSACTION will only return TRANSACTION segments under that ACCOUNT. When all transactions for that account are exhausted, GNP returns 'GE'.

Question 19 — Short Answer

What is MFS (Message Format Service) in IMS, and how does it simplify MPP programming?

Answer MFS (Message Format Service) is an IMS facility that separates the physical terminal format from the logical message format used by the application program. MFS definitions (MID — Message Input Descriptor, MOD — Message Output Descriptor, DIF — Device Input Format, DOF — Device Output Format) map between the screen layout seen by the terminal user and the message segments processed by the MPP. MFS simplifies MPP programming by: 1. **Isolating the program from terminal details** — The MPP works with logical message fields rather than screen positions or control characters. 2. **Enabling format changes without program changes** — Screen layouts can be modified by changing MFS definitions without recompiling the application program. 3. **Supporting multiple terminal types** — The same MPP can work with different terminals by using different DIF/DOF definitions mapped to the same MID/MOD.

Question 20 — Multiple Choice

Which statement about IMS logical relationships is correct?

A. A logical relationship can only exist between segments in the same physical database. B. A logical child segment physically exists in two databases simultaneously. C. A logical relationship creates a virtual pointer from a segment in one database to a segment in another database. D. Logical relationships eliminate the need for secondary indexes.

Answer **C. A logical relationship creates a virtual pointer from a segment in one database to a segment in another database.** Logical relationships allow an application to navigate from a segment in one physical database to a segment in another, creating an apparent hierarchy that spans multiple physical databases. The logical child contains a pointer to the logical parent in the other database. Logical relationships can exist between segments in different databases (most common) or within the same database.

Question 21 — True/False

The ISRT call requires that the parent segment be established in position before a child segment can be inserted.

Answer **True.** To insert a non-root segment, IMS must know under which parent the new segment belongs. The program must first establish position on the parent segment (via a GU or GN call, or by providing qualified SSAs for all parent levels in the ISRT call path). For root segments, no parent positioning is needed since the root has no parent.

Question 22 — Fill in the Blank

The IMS field in the PCB mask that indicates the name of the last segment type accessed by the most recent DL/I call is called the __.

Answer **segment name feedback area (or segment level name)** After each DL/I call, IMS updates the PCB mask with diagnostic information. The segment name feedback area contains the name of the lowest-level segment type that was processed by the call. This is useful in GN loops to determine which segment type was returned when navigating without qualified SSAs.

Question 23 — Multiple Choice

A secondary index in IMS is used to:

A. Speed up sequential processing of the root segment. B. Provide an alternate access path to segments using a non-key field. C. Replace the primary index in HIDAM databases. D. Store backup copies of database segments.

Answer **B. Provide an alternate access path to segments using a non-key field.** A secondary index creates an alternate way to access segments in a database using a field other than the hierarchical key. For example, if the CUSTOMER segment's key is CUST-ID, a secondary index on SOCIAL-SEC-NO allows programs to retrieve customers by Social Security Number. The secondary index is stored as a separate IMS database.

Question 24 — Short Answer

Explain the XRST (Extended Restart) call and how it works together with the CHKP call for batch program restart processing.

Answer The XRST/CHKP combination provides checkpoint/restart capability for IMS batch programs: 1. **XRST (Extended Restart):** Issued at the beginning of the program, XRST checks whether this is a normal start or a restart after failure. On normal start, it returns the I/O area unchanged. On restart, it restores the application's saved data (counters, file positions, control variables) from the last successful checkpoint, allowing the program to resume from where it left off. 2. **CHKP (Symbolic Checkpoint):** Issued periodically during processing (e.g., every N records), CHKP saves the application's working data to the IMS log and commits all database changes. The program specifies a checkpoint ID and the data areas to save. On restart: IMS backs out database changes made after the last checkpoint, and XRST restores the saved application data. The program then resumes processing from the checkpoint position rather than starting over from the beginning.

Question 25 — True/False

An IMS database can have only one root segment type, but it can have multiple segment types at each subsequent level.

Answer **True.** Every IMS database has exactly one root segment type. Below the root, each parent segment can have multiple child segment types (up to 255 total segment types in the database). For example, CUSTOMER (root) can have both ACCOUNT and LOAN as children at level 2, and each of those can have their own children at level 3.

Question 26 — Multiple Choice

What happens when a COBOL-IMS program issues a ROLL call?

A. The current transaction's database changes are committed. B. The current transaction's database changes are backed out, and the input message is discarded. C. The current transaction's database changes are backed out, and the input message is returned to the queue for reprocessing. D. The program's position in the database is reset to the beginning.

Answer **B. The current transaction's database changes are backed out, and the input message is discarded.** A ROLL call backs out all database changes made since the last commit point and discards the input message. This is different from a ROLB call, which also backs out changes but returns the input message to the program (in the I/O area) for possible reprocessing. Use ROLL when the message is invalid and should not be reprocessed; use ROLB when you want to retry.

Question 27 — Fill in the Blank

The IMS program type that runs in a batch region but shares database access with online transactions through the IMS control region is called a __.

Answer **BMP (Batch Message Processing program)** A BMP runs under the control of the IMS online system, sharing databases with MPP programs through IMS locking and scheduling. This avoids the need to take databases offline for batch processing and allows concurrent online and batch access.

Question 28 — Short Answer

A COBOL-IMS program needs to retrieve all accounts for customer 'C000054321' and then all transactions for each account. Outline the sequence of DL/I calls and the SSAs required.

Answer
1. GU  with qualified SSA: CUSTOMER(CUSTID   = C000054321)
   - Retrieves the target customer and establishes position.
   - Check for status blank (success) or 'GE' (not found).

2. GNP with unqualified SSA: ACCOUNT
   - Retrieves the first ACCOUNT under this customer.
   - If status is blank, proceed; if 'GE', no accounts exist.

3. For each ACCOUNT found:
   a. Save the current account data.
   b. GNP with unqualified SSA: TRANSACT
      - Retrieves the next TRANSACTION under the current account.
      - Loop until status = 'GE' (no more transactions for this account).
   c. After processing all transactions, issue another:
      GNP with unqualified SSA: ACCOUNT
      - Retrieves the next account.
      - Continue until 'GE' (no more accounts for this customer).
Note: After processing transactions with GNP for TRANSACT, the parentage may shift. An alternative approach is to use qualified SSAs or the `P` command code to explicitly manage parentage.

Question 29 — True/False

In IMS, a Scratchpad Area (SPA) is used to maintain state between iterations of a conversational transaction in an MPP.

Answer **True.** The SPA is a data area passed between iterations of a conversational MPP transaction. IMS saves the SPA when the program sends a response to the terminal and restores it when the next input message arrives for the same conversation. This allows the MPP to maintain context (such as which step of a multi-step process the user is on) without keeping the program or its resources active between user interactions.

Question 30 — Multiple Choice

Which of the following correctly describes the hierarchical sequence of an IMS database with structure CUSTOMER -> ACCOUNT -> TRANSACTION, where CUSTOMER also has a child LOAN?

A. CUSTOMER, LOAN, ACCOUNT, TRANSACTION B. CUSTOMER, ACCOUNT, LOAN, TRANSACTION C. CUSTOMER, ACCOUNT, TRANSACTION, LOAN D. The sequence depends on the DBD segment definition order.

Answer **D. The sequence depends on the DBD segment definition order.** The hierarchical sequence follows a top-to-bottom, left-to-right (depth-first) traversal of the hierarchy, and the "left-to-right" order of sibling segments is determined by the order in which they are defined in the DBD. If ACCOUNT is defined before LOAN in the DBD, the sequence for one customer occurrence would be: CUSTOMER, ACCOUNT, TRANSACTION(s) for that account, more ACCOUNTs and their TRANSACTIONs, then LOAN(s). If LOAN is defined before ACCOUNT, LOAN segments come first.