MainframeMaster
Progress0 of 0 lessons

CICS DL/I (IMS) Integration

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.

Why IMS Integration Matters

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.

Hierarchical Data

Access to hierarchical database structures with parent-child relationships.

Performance

High-performance database access optimized for transaction processing.

Legacy Support

Support for existing IMS applications and data structures.

IMS Integration Concepts

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.

IMS Database Structure

Database: Collection of related segments

Segment: Basic unit of data storage

Hierarchy: Parent-child relationships

Path: Route to access specific data

Hierarchical Structure:

text
1
2
3
4
5
6
CUSTOMER (Root Segment) ├── ORDER (Child Segment) │ ├── ORDER-LINE (Child Segment) │ └── SHIPMENT (Child Segment) └── ACCOUNT (Child Segment) └── TRANSACTION (Child Segment)

DL/I Interface

DL/I: Data Language/I interface

PCB: Program Communication Block

SSA: Segment Search Arguments

Call Interface: Standardized API calls

DL/I Components:

text
1
2
3
4
5
6
7
8
9
10
* Program Communication Block (PCB) * - Database name * - Segment types * - Processing options * - Status information * Segment Search Arguments (SSA) * - Segment name * - Qualification criteria * - Command codes

IMS Database Types

HDAM (Hierarchical Direct Access Method):

  • • Direct access to root segments
  • • Sequential access to child segments
  • • Good for random access patterns
  • • Efficient for large databases

HIDAM (Hierarchical Indexed Direct Access Method):

  • • Indexed access to root segments
  • • Sequential access to child segments
  • • Good for mixed access patterns
  • • Balanced performance characteristics

DL/I Calls from CICS

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.

Basic DL/I Calls

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:

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
IDENTIFICATION 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.

Update Operations

ISRT (Insert): Add new segments

DLET (Delete): Remove segments

REPL (Replace): Update existing segments

Error Handling: Check status codes

Update Example:

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
IDENTIFICATION 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.

Advanced DL/I Operations

Sequential Processing:

cobol
1
2
3
4
5
6
7
8
9
* 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:

cobol
1
2
3
4
5
6
7
* 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

Transaction coordination ensures data consistency between CICS and IMS systems. Proper coordination prevents data corruption and ensures reliable transaction processing.

CICS-IMS Coordination

Syncpoint: Coordinate commits across systems

Rollback: Automatic rollback on failure

Recovery: Built-in recovery mechanisms

Monitoring: Track transaction status

Coordination Example:

cobol
1
2
3
4
5
6
7
8
9
10
* 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

Error Handling

Status Codes: Check PCB status after calls

Rollback: Automatic rollback on errors

Logging: Record errors for analysis

Recovery: Implement recovery procedures

Error Handling:

cobol
1
2
3
4
5
6
7
8
9
10
* 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

Transaction Types

Conversational Transactions:

  • • Multiple DL/I calls per transaction
  • • Maintain database position
  • • User interaction between calls
  • • Longer transaction duration

Pseudo-Conversational Transactions:

  • • Single DL/I call per transaction
  • • No database position maintenance
  • • Better resource utilization
  • • Shorter transaction duration

Best Practices

Following established best practices ensures reliable IMS operations, optimal performance, and maintainable code in CICS applications.

DL/I Best Practices

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:

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
* 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

Performance Optimization

Efficient SSAs: Minimize search criteria

Batch Operations: Group related operations

Index Usage: Leverage database indexes

Transaction Design: Optimize transaction flow

Optimization Tips:

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
* 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

Common Mistakes to Avoid

Programming Errors:

  • • Not checking PCB status after calls
  • • Using wrong DL/I commands
  • • Incorrect SSA construction
  • • Missing error handling

Design Issues:

  • • Long-running transactions
  • • Inefficient database navigation
  • • Poor error recovery
  • • Inadequate logging

Quick Quiz

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?