[net.lang] Misleading COBOL semantics

gvcormack@watdaisy.UUCP (Gordon V. Cormack) (11/27/84)

The recent discussion of IF A LESS THAN B OR C etc. reminds me of
another case in which the semantics of COBOL are clearly not those
implied by English interpretation.  The statement

    MULTIPLY A BY B

stores the result in B, not A as is implied.  Therefore the following
COBOL statement is invalid, even though it makes perfect sense.

    MULTIPLY MY-SALARY BY 2.

In order to have the desired semantics, one must say:

    MULTIPLY 2 BY MY-SALARY.

Gordon Cormack     gvcormack@watdaisy.uucp 
                   gvcormack%watdasiy@waterloo.csnet

barmar@mit-eddie.UUCP (Barry Margolin) (11/30/84)

In article <6769@watdaisy.UUCP> gvcormack@watdaisy.UUCP (Gordon V. Cormack) writes:
>The statement
>
>    MULTIPLY A BY B
>
>stores the result in B, not A as is implied.

I was reading the transcript of a talk by Grace Hopper on the early
history and development of COBOL, and she mentioned that they wanted the
DIVIDE statement to be
	DIVIDE dividend BY divisor
because it is what people normally say, but they made it
	DIVIDE divisor INTO dividend
so that they could maintain the consistency of the result always being
the second value.  She didn't mention the MULTIPLY verb, but it looks
like in this case there wasn't a form of the English sentence that fit.
So, they obviously decided to abandon consistency with English in order
to maintain internal consistency in the language.  In other words, a
trade-off was necessary, and they chose the less intuitive one.
-- 
    Barry Margolin
    ARPA: barmar@MIT-Multics
    UUCP: ..!genrad!mit-eddie!barmar