| William M. Klein 2007-02-26, 6:55 pm |
| It has been a while since I posted a summary of "approaches" to the LOOP with
immediate exist issue - with summary comments on the PHILOSOPHICAL issues with
"GO TO and PERFORM THRU".
Comments in no particular order.
1) For some (unknown to me) reason, the use of SECTIONS is more common in Europe
while the use of PARAGRAPHS without SECTIONS is more common in the US. (This
may impact the programming style).
2) The '02 Standard introduced "EXIT PERFORM <CYCLE>" syntax which is a good way
to exit from within an inline loop. EXIT PARAGRAPH and EXIT SECTION provide
similar functionality for performed paragraphs and sections.
3) If one is coding in (or maintaining) programs in the "older" pre-85 Standard
(no scope delimiters or inline performs), a (possibly the most common in the
US) way to handle "loops" with immediate "problem" exits was something like.:
001-MAINLINE.
PERFORM 100-INITIAL-STUFF THRU 100-IS-EXIT
PERFORM 200-LOOP THRU 200-LOOP-EXIT
UNTIL SOME-CONDITION
PERFORM 900-FINAL-STUFF THRU 900-FS-EXIT
|