Simple Repetitive Loops

A simple repetitive loop is a repetitive DO loop in which the repetitor phrase is an expression that evaluates to a count of the iterations.

If repetitor is omitted but there is a conditional or if the repetitor is FOREVER, the group of instructions is nominally processed "forever", that is, until the condition is satisfied or a REXX instruction is processed that ends the loop (for example, LEAVE).

Note: For a discussion on conditional phrases, see section Conditional Phrases (WHILE and UNTIL).

In the simple form of a repetitive loop, exprr is evaluated immediately (and must result in a positive whole number or zero), and the loop is then processed that many times.

Example:
/* This displays "Hello" five times */
Do 5
  say 'Hello'
  end

Note that, similar to the distinction between a command and an assignment, if the first token of exprr is a symbol and the second token is (or starts with) =, the controlled form of repetitor is expected.


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/simprlp.html