I have many years' experience writing COBOL code and have used GO TO and
THRU only as a means of exiting a paragraph.  I frequently code paragraph
subroutines that perform a series of related edits, and would use them like
this:

     Perform 2000-Validate-Input thru 2000-exit.
*    test resultant switch settings here...     


 2000-Validate-Input.

     If some-test-here-failed
         Set indicator-switch to true
         Go to 2000-exit
     End-if.

     If some-other-test-fails
         Set indicator-different-switch to true
         Go to 2000-exit
     End-if.

* Blah, blah, blah

* When you get here, all tests are good and action can be taken

 2000-exit.
     Exit.


The THRU clause is only to support an "exit paragraph" ability.  Because I
follow some rules with this technique, it has never caused me a problem.
The rules?  They are simple:

- Only "go to" the exit point for the current paragraph.  I never span.
This means that the "go to" statements are always pointed downward - the
same way my perform statements always point.

- I verify that this rule is observed by F GO WORD in ISPF (with comments
excluded).  Each time I find a GO, I then look for P'####-' 8 to ensure that
the exit paragraph is the next paragraph.

I, too, believe that "thru" and "section" is a preference that can't be
persuaded in most people.  I personally hate to use sections and view them
as evil.  When forced to use sections, such as when performing an internal
sort, I just code unreferenced "dummy" sections around my input and output
sections.

It would be nice if an "exit paragraph" statement existed.  When it does,
I'll never need a THRU or GO TO again - and good riddance!

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to