Re: cobol array editing output

From: Judson McClendon (judmc_at_sunvaley0.com)
Date: 12/11/03


Date: Thu, 11 Dec 2003 07:00:18 -0600


"Chuck Stevens" <charles.stevens@unisys.com> wrote:
>
> "Judson McClendon" <judmc@sunvaley0.com> wrote:
> >
> > I shudder when I see programmers blithely using an exponential
> > operator in a bit fiddling routine, believing that because it looks elegant
> > and concise it therefore must also be efficient. Ouch! Give me a break!
> :-)
>
> This, and doing a hundred manipulations of the value of an index -- or a
> sole-purpose subscript -- for every reference to the table with which it's
> associated ... ;-)

We're in agreement, Chuck. I agree that indexing will almost always be
more efficient, and rarely less efficient in practice. But I have seen some
examples in real code over the years of programmers using indexes in
ways that were less efficient than subscripts, occasionally significantly
so. I don't know if you see as much crummy real world code as I do, but
there are some astonishingly dumb examples out there. I still remember
an example that a friend encountered and showed me over 30 years ago.
It was a B3500 COBOL 68 program that contained literally hundreds of
these references to one character fields:

        03 FIELD-X PIC X(01).

        EXAMINE FIELD-X TALLYING LEADING ZEROS.
        IF TALLY < 1 ...

The mind truly boggles. :-)

-- 
Judson McClendon      judmc@sunvaley0.com (remove zero)
Sun Valley Systems     http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."