z/OS TSO/E REXX User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


DO UNTIL Loops

z/OS TSO/E REXX User's Guide
SA32-0982-00

DO UNTIL loops in a flowchart appear as follows:

IKJC3005
As REXX instructions, the flowchart example looks like:
DO UNTIL  expression                   /* expression must be false */
   instruction(s)
END

Use DO UNTIL loops when a condition is not true and you want to execute the loop until the condition is true. The DO UNTIL loop tests the condition at the end of the loop and repeats only when the condition is false. Otherwise the loop executes once and ends. For example:

Example Using DO UNTIL

/******************************** REXX *****************************/
/* This exec uses a DO UNTIL loop to ask for a password.  If the   */
/* password is incorrect three times, the loop ends.               */
/*******************************************************************/
   password = 'abracadabra'
   time = 0
   DO UNTIL (answer = password) | (time = 3)
     SAY 'What is the password?'
     PULL answer
     time = time + 1
   END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014