Block structured COBOL (was Re: Re: [Nolug] Evo and Outlook)

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: 15 Jul 2003 16:40:09 -0500
Message-Id: <1058305209.25138.39.camel@haggis>

On Tue, 2003-07-15 at 09:58, jdtiede@bellsouth.net wrote:
> On 2003/07/15 10:32 EDT Judson Lester wrote:
> I'll admit my COBOL experience is limited to a casual flirting, but in
> that I can to two conclusions, which I'd be very pleased to be
> disabused of. One, COBOL is strongly oriented around decimal records,
> making it very limited outside of its intended realm, being (financial)
> business logic. (A subconclusion was that that realm was limited
> enough that it could be pleasantly implemented in a library of another
> language.)

True. Early on, there was a BCD package for Turbo Pascal, but
hardly anyone used it, and it was discontinued. I guess that
using a function call to add 2 numbers got a bit tedious.

> Two, that the control structures of COBOL were limited
> enough that it would be nearly impossible to code anything worthwhile
> with producing spaghetti code with goto-sauce.

COBOL-74 (and especially -68) sure made it easy, but not impossible,
at least in -74. The really excellent programmers I worked for
taught me this:

PROCEDURE DIVISION.
0000-BEGIN.
        BLAH BLAH.
        BLAH BLAH.
        PERFORM 100-SOME-LOGIC THROUGH 100-EXIT.
        PERFORM 200-SOME-LOGIC THROUGH 200-EXIT.
        PERFORM 300-SOME-LOGIC THROUGH 300-EXIT.
        PERFORM 400-SOME-LOGIC THROUGH 400-EXIT.
9999-EXIT.
        EXIT.

100-SOME-LOGIC.
        BLAH BLAH.
        PERFORM 110-SUB-LOGIC THROUGH 110-EXIT.
100-EXIT.
        RETURN. (??)
etc.
etc.

Then, GOTO within a "common number" block (i.e. 110-SUB-LOGIC through
110-EXIT) as much as you want, but *NEVER* GOTO out of that block
unless it's GOTO 9999-EXIT. Also, make liberal use of CALL to
sub-programs. (The VS COBOL compiler didn't enforce those GOTO
rules; the programmer "just" had to be conscientious.)

Thus, structured, block-oriented COBOL-74! Those were (I'm sure
they're retired by now, or moved to upper management) excellent
programmer.

-- 
+-----------------------------------------------------------+
| Ron Johnson, Jr.     Home: ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson |
|                                                           |
| 4 degrees from Vladimir Putin
+-----------------------------------------------------------+
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/15/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST