Download RPG/400 User's Guide

Transcript
Structured Programming
S
x
E
I n d
e
s t a
r t i n g
T
f i e
l d
t o
v a
l u e
Y
I n d
e
e n d
x
v a
i n g
l u e
v a
>
l u e ?
E
S
B r a
f o
n
c
l l o
w
h
t o
i n g
s t a
E N
t e
m
e
n
t
D
N O
P e
r f o
r m
a
l l
o p e r a t i o n s
E N
D
:
I n c r e m
i n d
e
i n c r e m
x
e n t
b
y
e n t i n g
v a l u e
Figure 7. Flowchart of a Do Operation
This is how the Do operation works:
1. Set the index field (result field) to the starting value (factor 1).
2. Test if the index field value is greater than the ending value (factor 2).
If the index field value is greater than the ending value, control passes to the
statement following the END statement.
3. If the index field value is not greater than the ending value, the operations
between the DO statement and the END statement are processed.
4. At END, the index field value is increased by the increment value specified in
factor 2 on the END statement, or by 1 if the increment is not specified.
5. Control passes to step 2 above.
10
RPG/400 User's Guide