
Students' Guide to
Program
Design
be included in the calculation of average score, so each time an exam
score is read, it must be tested for a 999 value, before further
processing can take place. For this reason the
Read
statement is placed
at the end of the loop, immediately before ENDDO, so that its value
can be tested when control returns to the DOWHILE condition. As
soon as the trailer record has been read, control will exit from the loop
to the next statement after ENDDO — the calculation of Average-score.
This priming read before the DOWHILE condition and subsequent
read within the loop, immediately before the ENDDO statement, forms