Module 1: Abend Codes
AICA- CICS Runaway Task
AICA means CICS decided a task was looping forever, so it killed the transaction to protect the region.
What it means
- AICA is the "runaway task" abend - CICS monitors how long a task runs without returning control, using the ICVR and DTIMOUT time limits.
- When a task exceeds the runaway limit, CICS abends it with AICA instead of letting it spin and block other work.
- The terminal user sees the transaction fail, and the CICS log records message DFHAC2236.
Common causes
- An infinite loop in the program logic - the loop exit condition is never met.
- A loop counter or pointer that is never incremented or moved inside the loop.
- Looping while waiting on a condition that never becomes true, with no CICS WAIT in between.
How to find it
- Look for DFHAC2236 in the CICS log, which names the transaction and terminal that went runaway.
- Take a transaction dump - it shows the program counter stuck at the looping instruction.
- Run the transaction under CEDF and step through the loop to see why it never exits.
How to fix it
- Find the loop and fix the exit logic - add the missing counter increment or the missing termination test.
- Add a safety counter that forces an exit after a sensible maximum number of iterations.
- For long but legitimate work, consider breaking it into smaller transactions instead of one giant loop.
Example
- This loop never ends - WS-COUNT is never incremented, so the transaction goes runaway and gets AICA:-
MOVE 0 TO WS-COUNT. PERFORM UNTIL WS-COUNT = 100 PERFORM PROCESS-RECORD END-PERFORM.
- The fix: increment the counter inside the loop:-
MOVE 0 TO WS-COUNT. PERFORM UNTIL WS-COUNT = 100 PERFORM PROCESS-RECORD ADD 1 TO WS-COUNT END-PERFORM.
- For safety, add a maximum-iteration guard so a bad exit test can never run away:-
MOVE 0 TO WS-COUNT. PERFORM UNTIL WS-COUNT = 100 OR WS-LOOP-GUARD > 100000 PERFORM PROCESS-RECORD ADD 1 TO WS-COUNT ADD 1 TO WS-LOOP-GUARD END-PERFORM.
