CICS LINK vs XCTL - Transaction Design Decision
Table of Contents
Interview Question
"You're designing a claims processing system with 4 CICS programs:
PROGRAM A (CLMENTRY): Data entry screen
- Collects claim details (500 bytes)
- Validates input
- Calls next program
PROGRAM B (CLMVALID): Business validation
- Checks policy status
- Verifies coverage limits
- Returns validation results (200 bytes)
PROGRAM C (CLMCALC): Claim calculation
- Calculates payout amount
- Applies deductibles
- Returns calculation (100 bytes)
PROGRAM D (CLMSTORE): Database update
- Stores claim in DB2
- Updates policy status
- Returns confirmation
Design Questions:
1. Which programs should use LINK vs XCTL?
2. How do you manage COMMAREA across the chain?
3. What happens if CLMCALC ABENDs?
4. How do you optimize transaction response time?"
What This Tests
- CICS program design patterns
- Understanding of LINK vs XCTL mechanics
- Transaction flow design
- Error handling and recovery
Good Answer Should Include
1. Design Decision:
Option A (RETURN to caller pattern):
CLMENTRY → LINK → CLMVALID (returns)
→ LINK → CLMCALC (returns)
→ LINK → CLMSTORE (returns)
→ Return to CICS
Option B (Chain pattern - RECOMMENDED):
CLMENTRY → XCTL → CLMVALID → XCTL → CLMCALC → XCTL → CLMSTORE → RETURN
Why Option B is Better:
- Less storage usage (program removed from memory after XCTL)
- Better transaction response (no return overhead)
- Cleaner error handling (each program independent)
- Lower CICS region storage consumption
2. COMMAREA Management:
* In CLMENTRY (first program)
01 WS-COMMAREA.
05 CLAIM-DATA.
10 CLAIM-NUMBER PIC X(10).
10 POLICY-NUMBER PIC X(12).
10 CLAIM-AMOUNT PIC 9(9)V99 COMP-3.
* ... (500 bytes total)
05 VALIDATION-RESULTS PIC X(200).
05 CALCULATION-RESULTS PIC X(100).
05 CURRENT-PROGRAM PIC X(8).
05 ERROR-FLAG PIC X(1).
PROCEDURE DIVISION.
* Initialize
MOVE 'CLMENTRY' TO CURRENT-PROGRAM
* Call validation
EXEC CICS XCTL
PROGRAM('CLMVALID')
COMMAREA(WS-COMMAREA)
LENGTH(800)
END-EXEC.
* In CLMVALID (middle program)
LINKAGE SECTION.
01 DFHCOMMAREA.
COPY CLAIMCA.
PROCEDURE DIVISION.
* Receive COMMAREA
MOVE 'CLMVALID' TO CURRENT-PROGRAM
* Perform validation
* Populate VALIDATION-RESULTS
* Chain to next
EXEC CICS XCTL
PROGRAM('CLMCALC')
COMMAREA(DFHCOMMAREA)
LENGTH(800)
END-EXEC.
3. Error Handling:
* Each program has error handling
IF ERROR-DETECTED
MOVE 'Y' TO ERROR-FLAG
MOVE ERROR-MESSAGE TO VALIDATION-RESULTS
EXEC CICS RETURN
TRANSID('CLME')
COMMAREA(DFHCOMMAREA)
LENGTH(800)
END-EXEC
END-IF.
* CLMENTRY handles errors on return
IF ERROR-FLAG = 'Y'
DISPLAY ERROR-MESSAGE ON SCREEN
PERFORM ERROR-RECOVERY
END-IF.
4. ABEND Scenario (CLMCALC fails):
- With LINK: Control returns to CLMENTRY, can handle error gracefully
- With XCTL: Transaction ABENDs, need CICS error handling
- Solution:
- Implement HANDLE ABEND in each program
- Write to error log/queue
- Return graceful error to terminal
5. Performance Optimization:
| Metric | LINK Pattern | XCTL Pattern |
|---|---|---|
| Storage | Higher (all programs in memory) | Lower (one program at a time) |
| CPU | Higher (return overhead) | Lower (direct transfer) |
| Response Time | ~50ms overhead per LINK | ~10ms overhead per XCTL |
| Total (4 programs) | +150ms | +30ms |
Recommendation: Use XCTL for production claims processing
6. Exception: When to Use LINK:
* Use LINK when you need return values
CLMENTRY → LINK → UTILITY-PROGRAM (returns lookup data)
→ Continue processing with returned data
Red Flags
- ❌ Doesn't know programs are removed from memory after XCTL
- ❌ Thinks LINK is always better (doesn't understand storage impact)
- ❌ Can't explain COMMAREA propagation
- ❌ No error handling strategy
- ❌ Doesn't consider performance implications
Follow-Up Questions
- "What if CLMVALID needs data from CLMENTRY after CLMCALC completes?"
- "How large can COMMAREA be?"
- "What happens if you XCTL with wrong COMMAREA length?"
- "How do you pass data if COMMAREA exceeds 32K?"
Difficulty Level
Mid to Senior
Relevant Roles
CICS Developer, Application Architect, Technical Lead