Yielding loops

Yielding loops are characterized by returning control at some point to a CICS routine that can suspend the looping task. However, the looping task is eventually resumed, and so the loop continues.

CICS is unable to use the runaway task timer to detect yielding loops, because the timer is reset whenever the task is suspended. Thus, the runaway task time is unlikely ever to be exceeded, and so the loop goes undetected by the system.

Yielding loops typically involve a number of programs. The programs might be linked to and returned from, or control might be transferred from one program to another in the loop. A yielding loop can also be confined to just one program, in which case it must contain at least one wait-enabling CICS command.

Figure 1 shows a specific example of a yielding loop within a single program. This code issues the SUSPEND command, which is always a yielding type of command. Every time SUSPEND is issued, the dispatcher suspends the task issuing the request, and sees if any other task of higher priority can run. If no such task is ready, the program that issued the SUSPEND is resumed.
Figure 1. Example of code containing a 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
         SUSPEND
     END-EXEC.
     GO TO NEW-LINE-ATTRIBUTE.
     MOVE LOW-VALUES TO PRNTAREA.
     MOVE DFHBMPNL TO PRNTAREA.
You can detect a yielding loop only by circumstantial evidence such as repetitive output, or excessive use of storage. A fuller description of what to look out for is given in Loops.

If you suspect that you have a yielding loop, turn to Investigating loops that are not detected by CICS for further guidance.



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