Do Forever Loops - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

IMPORTANT - Stopping An Infinite Loop
When you suspect an exec is in an infinite loop, you can end the exec by
pressing the attention interrupt key, sometimes labeled PA1. You will then see
message IRX0920I. In response to this message, type HI for halt interpretation
and press the Enter key. If that doesn't stop the loop, you can press the
attention interrupt key again, type HE for halt execution, and press the Enter
key.
HI will not halt an infinitely looping or long running external function, subroutine, or
host command written in a language other than REXX and that was called by your
exec. The HI condition is not checked by the REXX interpreter until control returns
from the function, subroutine, or host command.
Example of EXEC1, an exec that calls an external function
/********************* REXX ****************************************/
/* Invoke a user-written external function, 'myfunct'.
/* not written in REXX. For example, it might have been coded
/* in PL/I or assembler.
/*******************************************************************/
x = myfunct(1)
exit
If myfunct enters an infinite loop, pressing the attention interrupt key and entering
HI will not stop myfunct. However, pressing the attention interrupt key and then
entering HE will stop the function and the exec (EXEC1) that called it. HE does not
automatically stop any exec that called EXEC1, unless you are running under ISPF.
For more information about the HE condition, see z/OS TSO/E REXX Reference.
Note: HE does not alter the halt condition, which is raised by HI. If you entered HI
before you entered HE (for example, you may have first issued HI and it
failed to end your exec), the halt condition will remain set for the exec and all
calling execs. HE will stop your exec, and then the halt condition, raised
when you entered HI, will be recognized by any exec that called your exec.

DO FOREVER Loops

Sometimes you might want to purposely write an infinite loop; for instance, in an
exec that reads records from a data set until it reaches end of file, or in an exec
that interacts with a user until the user enters a particular symbol to end the loop.
You can use the EXIT instruction to end an infinite loop when a condition is met, as
in the following example. More about the EXIT instruction appears in "EXIT
Instruction" on page 57.
Using Looping Instructions
Chapter 4. Controlling the Flow Within an Exec
*/
*/
*/
49

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents