end
/*
1.7
*/
/*
2.4
*/
/*
3.1
*/
/*
3.8
*/
The control variable can be altered within the loop, and this may affect the iteration of the loop. Altering
the value of the control variable is not usually considered good programming practice, though it may be
appropriate in certain circumstances.
Note that the end condition is tested at the start of each iteration (and after the control variable is stepped,
on the second and subsequent iterations). Therefore, if the end condition is met immediately, the group of
instructions can be skipped entirely. Note also that the control variable is referred to by name. If (for
example) the compound name
A.I
is used for the control variable, altering
I
within the loop causes a
change in the control variable.
The execution of a controlled loop can be bounded further by a FOR phrase. In this case, you must
specify
exprf
, and it must evaluate to a positive whole number or zero. This acts just like the repetition
count in a simple repetitive loop, and sets a limit to the number of iterations around the loop if no other
condition stops it. Like the TO and BY expressions, it is evaluated only one time—when the DO instruction
is first processed and before the control variable receives its initial value. Like the TO condition, the FOR
condition is checked at the start of each iteration.
Example:
Do Y=0.3 to 4.3 by 0.7 for 3
/* Displays:
*/
say Y
/*
0.3
*/
end
/*
1.0
*/
/*
1.7
*/
In a controlled loop, the
name
describing the control variable can be specified on the END clause. This
name
must match
name
in the DO clause in all respects except case (note that no substitution for
compound variables is carried out); a syntax error results if it does not. This enables the nesting of loops
to be checked automatically, with minimal overhead.
Example:
Do K=1 to 10
...
...
End k
/* Checks that this is the END for K loop */
Note:
The NUMERIC settings may affect the successive values of the control variable, because REXX
arithmetic rules apply to the computation of stepping the control variable.
Conditional Phrases (WHILE and UNTIL)
A conditional phrase can modify the iteration of a repetitive DO loop. It may cause the termination of a
loop. It can follow any of the forms of
repetitor
(none, FOREVER, simple, or controlled). If you specify
WHILE or UNTIL,
exprw
or
expru
, respectively, is evaluated each time around the loop using the latest
values of all variables (and must evaluate to either
0
or
1
), and the loop is ended if
exprw
evaluates to
0
or
expru
evaluates to
1
.
For a WHILE loop, the condition is evaluated at the top of the group of instructions. For an UNTIL loop,
the condition is evaluated at the bottom—before the control variable has been stepped.
Example:
Do I=1 to 10 by 2 until i>6
say i
end
/* Displays: "1" "3" "5" "7" */
DO
140
CICS TS for VSE/ESA: REXX Guide
Содержание SC34-5764-01
Страница 1: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Страница 2: ......
Страница 3: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Страница 22: ...xx CICS TS for VSE ESA REXX Guide...
Страница 23: ...Part 1 User s Guide Copyright IBM Corp 1992 2009 1...
Страница 24: ...2 CICS TS for VSE ESA REXX Guide...
Страница 40: ...18 CICS TS for VSE ESA REXX Guide...
Страница 54: ...Using Variables and Expressions 32 CICS TS for VSE ESA REXX Guide...
Страница 106: ...84 CICS TS for VSE ESA REXX Guide...
Страница 110: ...88 CICS TS for VSE ESA REXX Guide...
Страница 122: ...100 CICS TS for VSE ESA REXX Guide...
Страница 123: ...Part 2 Reference Copyright IBM Corp 1992 2009 101...
Страница 124: ...102 CICS TS for VSE ESA REXX Guide...
Страница 130: ...Introduction 108 CICS TS for VSE ESA REXX Guide...
Страница 152: ...REXX General Concepts 130 CICS TS for VSE ESA REXX Guide...
Страница 224: ...Functions 202 CICS TS for VSE ESA REXX Guide...
Страница 252: ...230 CICS TS for VSE ESA REXX Guide...
Страница 278: ...256 CICS TS for VSE ESA REXX Guide...
Страница 312: ...DB2 Interface 290 CICS TS for VSE ESA REXX Guide...
Страница 316: ...High level Client Server Support 294 CICS TS for VSE ESA REXX Guide...
Страница 340: ...318 CICS TS for VSE ESA REXX Guide...
Страница 344: ...for execs Commands 322 CICS TS for VSE ESA REXX Guide...
Страница 399: ...Part 3 Appendixes Copyright IBM Corp 1992 2009 377...
Страница 400: ...378 CICS TS for VSE ESA REXX Guide...
Страница 438: ...416 CICS TS for VSE ESA REXX Guide...
Страница 442: ...System Definition Customization Administration 420 CICS TS for VSE ESA REXX Guide...
Страница 446: ...Security 424 CICS TS for VSE ESA REXX Guide...
Страница 448: ...426 CICS TS for VSE ESA REXX Guide...
Страница 464: ...442 CICS TS for VSE ESA REXX Guide...
Страница 466: ...444 CICS TS for VSE ESA REXX Guide...
Страница 468: ...446 CICS TS for VSE ESA REXX Guide...
Страница 476: ...454 CICS TS for VSE ESA REXX Guide...
Страница 478: ...456 CICS TS for VSE ESA REXX Guide...
Страница 479: ......
Страница 480: ...SC34 5764 01...
Страница 481: ...Spine information CICS TS for VSE ESA REXX Guide...