For Programmers: Free Programming Magazines  


Home > Archive > Cobol > September 2004 > COMPUTE (was: "Goto statement considered superfluous" (was: If you were inv









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author COMPUTE (was: "Goto statement considered superfluous" (was: If you were inv
William M. Klein

2004-09-28, 3:55 am

Chuck,
I didn't check out the '74 Standard, but at least in the '85 Standard the
*entire* COMPUTE statement is in Nucleus level 2. Therefore, a conforming
Minimum or Intermediate level compiler need not support it. That doesn't mean
it wasn't in the Standard - but this *might* have lead to some confusion, i.e.
"conforming '68 or '74 compiler didn't include COMPUTE".

Personally, I don't know of any that did NOT have this statement, but it was
possible.

--
Bill Klein
wmklein <at> ix.netcom.com
"Chuck Stevens" <charles.stevens@unisys.com> wrote in message
news:cj1rjd$g7i$1@si05.rsvl.unisys.com...
>
> "Richard" <riplin@Azonic.co.nz> wrote in message
> news:217e491a.0409241040.5d748b06@posting.google.com...
>
>
> No, again, I believe the evidence shows that is *not* the case.
>
> The available evidence has convinced me that COMPUTE has been in COBOL since
> its very beginnings. What *wasn't* in the earliest forms of COBOL was
> *multiple-destination* COMPUTE (nor were multiple-destination ADD, SUBTRACT,
> MULTIPLY or DIVIDE, for that matter).
>
>
> As I see it, that's needed *only* for *multiple-destination* COMPUTE (and
> only then if the descriptions of the destinations differ). With 2002
> COBOL, and the availability of SIDI's, in *standard* arithmetic all the
> operands are treated as if they're in SIDI's in the first place, so there's
> no distinction between the simple COMPUTE and the simple ADD, for example.
>
> I don't see anything in any of the COBOL standards that prevents
> implementors from making a simple COMPUTE just as fast and just as efficient
> as an equivalent ADD, SUBTRACT MULTIPLY or DIVIDE statement given the
> knowledge the compiler has of the operands, the operators, and the
> destination, even in native arithmetic, although I can understand that an
> implementor might choose not to bother.
>
> Our COBOL74 and COBOL85 compilers both generate *exactly* the same code for
> each of these statements:
> ADD A 1 GIVING A.
> ADD 1 TO A.
> COMPUTE A = A + 1.
> What in the standards *requires* that the code be different?
>
> -Chuck Stevens
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com