DO UNTIL Loops

DO UNTIL loops in a flowchart appear as follows:

dfhrx005

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:
Figure 1. Example Using DO UNTIL
/******************************** REXX ******************************/
/* This program 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)
     PULL answer                  /* Gets ANSWER from input stream  */
     time = time + 1
   END

Reference Reference

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/dfhrx00048.html