Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
DO FOREVER Loops z/OS TSO/E REXX User's Guide SA32-0982-00 |
|
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. Example Using a DO FOREVER Loop
This example sends data sets to the printer and then issues a message that the data set was printed. When the user enters a blank, the loop ends and so does the exec. To end the loop without ending the exec, use the LEAVE instruction, as described in the following topic. |
Copyright IBM Corporation 1990, 2014
|