Ok, this should never have worked. In a REXX DO TO, the "end expression" in the DO statement is evaluated once when the loop starts. It's not reevaluated every time through the loop. So the value of test.0 is evaluated once (to be 7) and that's it for the rest of the loop. You can change the value of test.0 itself inside the loop, but that doesn't effect the number of iterations of the loop.
If you're going to be changing the value of some variable used in the test expression, don't use a DO TO loop. Use something like DO WHILE or DO UNTIL, which evaluates the expression each time through the loop.test.0 = 7
test.1 = 'This is line 1'
test.2 = 'This is line 2'
test.3 = 'This is line 3'
test.4 = 'This is line 4'
test.5 = ''
test.6 = 'This is line 6'
test.7 = 'This is line 7'
i = 1
DO WHILE i <= test.0
SAY 'test.0 =' test.0 'i =' i
IF test.i == '' THEN
STEMDELETE('test.', , i, 1)
ELSE
i - i + 1
END |