Tight loops and non-yielding loops

Tight loops and non-yielding loops are both characterized by the fact that the looping task can never be suspended within the limits of the loop. This makes them detectable by CICS®, which compares the time they have been running continually with the runaway time interval, ICVR, that you code in the system initialization table.

For information about how CICS handles a looping or runaway task that runs in a JVM server, see CICS task and thread management.

If the tasks run for longer than the interval you specify, CICS regards them as “runaway” and causes them to abend with an abend code of AICA.

Note: If you make the ICVR value equal to 0, runaway task detection is disabled. Runaway tasks can then cause the CICS region to stall, meaning that CICS must be canceled and brought up again. You might choose to set ICVR to zero in test systems, because of the wide variation in response times. However, it is usually more advisable to set ICVR to a large value in test systems.

A tight loop is one involving a single program, where the same instructions are executed repeatedly and control is never returned to CICS. In the extreme case, there could be a single instruction in the loop, causing a branch to itself.

A non-yielding loop is also contained in a single program, but it differs from a tight loop in that control is returned temporarily from the program to CICS. However, the CICS routines that are invoked are ones that neither suspend the program nor pass control to the dispatcher. The CICS commands that do not cause tasks to wait include (but are not restricted to) ASKTIME, DEQ, ENQ, ENTER TRACENUM, FREEMAIN, HANDLE, RELEASE, TRACE ON/OFF. Whether a command allows the ICVR to be reset might also depend on other factors. For instance, a FREEMAIN might reset the ICVR if the storage lock is held. A READ might also not wait if the intended record is already in a VSAM buffer. There is, therefore, no point at which the task can be suspended, and so the ICVR cannot be reset.

Figure 1 shows an example of code that contains a simple non-yielding loop. In this case, the loop contains only one CICS command, EXEC CICS ASKTIME.

Figure 1. Example of code containing a non-yielding loop
 PROCEDURE DIVISION.
     EXEC CICS
         HANDLE CONDITION ERROR(ERROR-EXIT)
               ENDFILE(END-MSG)
     END-EXEC.
 ROUTE-FILE.
     EXEC CICS
         ROUTE INTERVAL(0)
               LIST(TERM-ID)
     END-EXEC.
  NEW-LINE-ATTRIBUTE.
     EXEC CICS
         ASKTIME
     END-EXEC.
     GO TO NEW-LINE-ATTRIBUTE.
     MOVE LOW-VALUES TO PRNTAREA.
     MOVE DFHBMPNL TO PRNTAREA.

If you have a transaction that repeatedly abends with an abend code of AICA, first make sure the ICVR value has not been set too low. If the value seems reasonable, read Investigating loops that cause transactions to abend with abend code AICA for advice on determining the limits of the loop.

If you have a stalled CICS region, diagnose the problem using the techniques in What to do if CICS has stalled. Check if the ICVR value has been set to zero. If it has, change the value and try to cause a transaction to abend with a code of AICA.



dfhs1c00162.html | Timestamp icon Last updated: Monday, 5 June 2017