Learn how to integrate IMS databases with CICS applications effectively. Master DL/I calls, transaction coordination, and best practices for reliable IMS database operations in CICS environments.
IMS (Information Management System) integration enables CICS applications to access hierarchical databases, providing fast, reliable data access for high-volume transaction processing. This integration is essential for legacy systems and applications requiring hierarchical data structures.
Access to hierarchical database structures with parent-child relationships.
High-performance database access optimized for transaction processing.
Support for existing IMS applications and data structures.
Understanding IMS integration concepts is essential for effective CICS-IMS applications. IMS provides hierarchical database structures with DL/I (Data Language/I) as the interface.
Database: Collection of related segments
Segment: Basic unit of data storage
Hierarchy: Parent-child relationships
Path: Route to access specific data
Hierarchical Structure:
123456CUSTOMER (Root Segment) ├── ORDER (Child Segment) │ ├── ORDER-LINE (Child Segment) │ └── SHIPMENT (Child Segment) └── ACCOUNT (Child Segment) └── TRANSACTION (Child Segment)
DL/I: Data Language/I interface
PCB: Program Communication Block
SSA: Segment Search Arguments
Call Interface: Standardized API calls
DL/I Components:
12345678910* Program Communication Block (PCB) * - Database name * - Segment types * - Processing options * - Status information * Segment Search Arguments (SSA) * - Segment name * - Qualification criteria * - Command codes
HDAM (Hierarchical Direct Access Method):
HIDAM (Hierarchical Indexed Direct Access Method):
DL/I calls allow CICS programs to access IMS databases. These calls provide the interface between CICS applications and IMS data, enabling hierarchical data operations.
GU (Get Unique): Retrieve specific segment
GN (Get Next): Retrieve next segment
GNP (Get Next within Parent): Next child segment
GHU (Get Hold Unique): Hold for update
Basic Call Example:
1234567891011121314151617181920212223242526272829IDENTIFICATION DIVISION. PROGRAM-ID. DLIGET. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-CUSTOMER-ID PIC X(10). 01 WS-CUSTOMER-NAME PIC X(30). 01 WS-CUSTOMER-ADDR PIC X(50). 01 WS-PCB PIC X(8). 01 WS-SSA PIC X(50). PROCEDURE DIVISION. * Get customer by ID MOVE 'GU' TO WS-COMMAND MOVE 'CUSTOMER' TO WS-SEGMENT-NAME MOVE WS-CUSTOMER-ID TO WS-SEARCH-KEY CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT * Check return code IF WS-PCB-STATUS = ' ' PERFORM PROCESS-CUSTOMER ELSE PERFORM HANDLE-ERROR END-IF EXEC CICS RETURN END-EXEC.
ISRT (Insert): Add new segments
DLET (Delete): Remove segments
REPL (Replace): Update existing segments
Error Handling: Check status codes
Update Example:
1234567891011121314151617181920212223242526IDENTIFICATION DIVISION. PROGRAM-ID. DLIUPD. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-COMMAND PIC X(4). 01 WS-SEGMENT-NAME PIC X(8). 01 WS-SEARCH-KEY PIC X(10). 01 WS-PCB PIC X(8). 01 WS-SSA PIC X(50). PROCEDURE DIVISION. * Get hold of customer segment MOVE 'GHU' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT * Update customer address MOVE 'NEW ADDRESS' TO WS-CUSTOMER-ADDR * Replace the segment MOVE 'REPL' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT EXEC CICS RETURN END-EXEC.
Sequential Processing:
123456789* Process all customers sequentially MOVE 'GU' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT PERFORM UNTIL WS-PCB-STATUS NOT = ' ' PERFORM PROCESS-CUSTOMER MOVE 'GN' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT END-PERFORM
Sequential processing allows you to iterate through all segments.
Hierarchical Navigation:
1234567* Navigate customer hierarchy MOVE 'GU' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT * Get first order for customer MOVE 'GNP' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-ORDER-SEGMENT
Hierarchical navigation follows parent-child relationships.
Transaction coordination ensures data consistency between CICS and IMS systems. Proper coordination prevents data corruption and ensures reliable transaction processing.
Syncpoint: Coordinate commits across systems
Rollback: Automatic rollback on failure
Recovery: Built-in recovery mechanisms
Monitoring: Track transaction status
Coordination Example:
12345678910* Update IMS database MOVE 'REPL' TO WS-COMMAND CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-CUSTOMER-SEGMENT * Update CICS file EXEC CICS REWRITE FILE('CUSTFILE') FROM(WS-CUSTOMER-RECORD) END-EXEC * Commit both changes EXEC CICS SYNCPOINT END-EXEC
Status Codes: Check PCB status after calls
Rollback: Automatic rollback on errors
Logging: Record errors for analysis
Recovery: Implement recovery procedures
Error Handling:
12345678910* Check DL/I call result IF WS-PCB-STATUS = ' ' PERFORM SUCCESS-PROCESSING ELSE IF WS-PCB-STATUS = 'GE' PERFORM SEGMENT-NOT-FOUND ELSE IF WS-PCB-STATUS = 'GB' PERFORM END-OF-DATABASE ELSE PERFORM HANDLE-ERROR END-IF
Conversational Transactions:
Pseudo-Conversational Transactions:
Following established best practices ensures reliable IMS operations, optimal performance, and maintainable code in CICS applications.
Always Check Status: Verify PCB status after calls
Use Appropriate Commands: Choose right DL/I command
Optimize SSAs: Efficient segment search arguments
Error Handling: Comprehensive error management
Status Checking:
12345678910111213* Always check PCB status CALL 'CBLTDLI' USING WS-PCB, WS-COMMAND, WS-SSA, WS-SEGMENT EVALUATE WS-PCB-STATUS WHEN ' ' * Success PERFORM SUCCESS-PROCESSING WHEN 'GE' * Segment not found PERFORM HANDLE-NOT-FOUND WHEN 'GB' * End of database PERFORM END-PROCESSING WHEN OTHER * Error PERFORM HANDLE-ERROR END-EVALUATE
Efficient SSAs: Minimize search criteria
Batch Operations: Group related operations
Index Usage: Leverage database indexes
Transaction Design: Optimize transaction flow
Optimization Tips:
1234567891011121314* Use efficient SSAs * - Minimize search criteria * - Leverage database indexes * - Use appropriate command codes * Batch operations * - Group related DL/I calls * - Minimize transaction overhead * - Use appropriate commit points * Monitor performance * - Track DL/I call frequency * - Measure response times * - Identify bottlenecks
Programming Errors:
Design Issues:
Question 1:
What is the difference between GU and GN DL/I commands?
Question 2:
How do you coordinate transactions between CICS and IMS?
Question 3:
What are the main benefits of using IMS with CICS?