From: Lee on
Fujitsu claims their (incorrect) result is the same as that produced by IBM
COBOL on MVS or whatever they run nowadays. Can someone please confirm
this? TIA



01 W-Depr-Rem Pic S9(15)V9(2) Comp Value +0.
01 W-Est-Life-Y Pic S9(11)V9(6) Comp Value +5.
01 W-Depr-Mhs Pic S9(7) Comp Value +2.
01 W-Value Pic S9(11)V9(6) Comp Value +14800.
01 W-Depr-Tot Pic S9(11)V9(6) Comp Value +0.
01 W-Depr Pic S9(11)V9(6) Comp Value +0.

PROCEDURE DIVISION.

Compute W-Depr = (2 / W-Est-Life-Y) * (W-Value - W-Depr-Tot) *
(W-Depr-Mhs /12).



*The result of the above calculation using Fujitsu is
+00000000986.662720
*The same calculation in Microfocus is +00000000986.666666



From: on
In article <vmiEf.40880$dW3.22826(a)newssvr21.news.prodigy.com>,
Lee <flu8349nospam(a)nospam.yahoo.com> wrote:
>Fujitsu claims their (incorrect) result is the same as that produced by IBM
>COBOL on MVS or whatever they run nowadays. Can someone please confirm
>this? TIA
>
>
>
> 01 W-Depr-Rem Pic S9(15)V9(2) Comp Value +0.
> 01 W-Est-Life-Y Pic S9(11)V9(6) Comp Value +5.
> 01 W-Depr-Mhs Pic S9(7) Comp Value +2.
> 01 W-Value Pic S9(11)V9(6) Comp Value +14800.
> 01 W-Depr-Tot Pic S9(11)V9(6) Comp Value +0.
> 01 W-Depr Pic S9(11)V9(6) Comp Value +0.
>
> PROCEDURE DIVISION.
>
> Compute W-Depr = (2 / W-Est-Life-Y) * (W-Value - W-Depr-Tot) *
>(W-Depr-Mhs /12).
>
>
>
> *The result of the above calculation using Fujitsu is
>+00000000986.662720
> *The same calculation in Microfocus is +00000000986.666666

Using IBM Enterprise COBOL for z/OS and OS/390 3.2.0 and the same code as
above but including:

01 W-DEPR-DISP PIC Z(11).9(6)+ VALUE ZEROES.

....

MOVE W-DEPR TO W-DEPR-DISP.
DISPLAY ' DEPR DISP = ', W-DEPR-DISP.

....

.... the compile generates a return-code of 4 (IGYPS0001-W A blank was
missing before character "1" in column 42. A blank was assumed.) and
throws out the following in the JESlog:

DEPR DISP = 986.662720+

DD

From: Michael Mattias on
"Lee" <flu8349nospam(a)nospam.yahoo.com> wrote in message
news:vmiEf.40880$dW3.22826(a)newssvr21.news.prodigy.com...
> Fujitsu claims their (incorrect) result is the same as that produced by
IBM
> COBOL on MVS or whatever they run nowadays. Can someone please confirm
> this? TIA
> *The result of the above calculation using Fujitsu is
> +00000000986.662720
> *The same calculation in Microfocus is +00000000986.666666

That 'same as' claim should probably be qualified, since you can get
different results on IBM depending on compile-time options;e.g., the TRUNC
and FLOAT options come to mind for arithmetic.

Besides, in the example you have here, this code is not written correctly if
you want that many digits of precision in the answer. Your intermediate
values are almost certainly getting rounded 'somewhere' and depending on
where that occurs it will affect the final result to varying degrees. You
need to control the rounding yourself and/or COMPUTE the intermediate values
yourself to WS variables of sufficient precision.

MCM









From: Sergey Kashyrin on
That's the question which result is incorrect.
I don't know Cobol that well but as I can recall 70-s, for PL/I there was an
IBM document describing exactly how FIXED operations performing.
What I mean is what's the TYPE of the (intermidiate) result of (W-Depr-Mhs
/12).
Because it's just "12", the result type of this operation should be the type
of W-Depr-Mhs, i.e. S9(11)V9(6)
In this case IBM result is correct and Microfocus (as well as OpenCobol) are
wrong !
If you change "12" by "12.000000000000" you'll get Microfocus result.

BTW, AS/400 is giving the same result as 390.

Regards,
Sergey.

"Lee" <flu8349nospam(a)nospam.yahoo.com> wrote in message
news:vmiEf.40880$dW3.22826(a)newssvr21.news.prodigy.com...
> Fujitsu claims their (incorrect) result is the same as that produced by
> IBM COBOL on MVS or whatever they run nowadays. Can someone please
> confirm this? TIA
>
>
>
> 01 W-Depr-Rem Pic S9(15)V9(2) Comp Value +0.
> 01 W-Est-Life-Y Pic S9(11)V9(6) Comp Value +5.
> 01 W-Depr-Mhs Pic S9(7) Comp Value +2.
> 01 W-Value Pic S9(11)V9(6) Comp Value +14800.
> 01 W-Depr-Tot Pic S9(11)V9(6) Comp Value +0.
> 01 W-Depr Pic S9(11)V9(6) Comp Value +0.
>
> PROCEDURE DIVISION.
>
> Compute W-Depr = (2 / W-Est-Life-Y) * (W-Value - W-Depr-Tot) *
> (W-Depr-Mhs /12).
>
>
>
> *The result of the above calculation using Fujitsu is
> +00000000986.662720
> *The same calculation in Microfocus is +00000000986.666666
>
>
>


From: Rick Smith on

"Lee" <flu8349nospam(a)nospam.yahoo.com> wrote in message
news:vmiEf.40880$dW3.22826(a)newssvr21.news.prodigy.com...
> Fujitsu claims their (incorrect) result is the same as that produced by
IBM
> COBOL on MVS or whatever they run nowadays. Can someone please confirm
> this? TIA
>
>
>
> 01 W-Depr-Rem Pic S9(15)V9(2) Comp Value +0.
> 01 W-Est-Life-Y Pic S9(11)V9(6) Comp Value +5.
> 01 W-Depr-Mhs Pic S9(7) Comp Value +2.
> 01 W-Value Pic S9(11)V9(6) Comp Value +14800.
> 01 W-Depr-Tot Pic S9(11)V9(6) Comp Value +0.
> 01 W-Depr Pic S9(11)V9(6) Comp Value +0.
>
> PROCEDURE DIVISION.
>
> Compute W-Depr = (2 / W-Est-Life-Y) * (W-Value - W-Depr-Tot) *
> (W-Depr-Mhs /12).
>
>
>
> *The result of the above calculation using Fujitsu is
> +00000000986.662720
> *The same calculation in Microfocus is +00000000986.666666

Using the directive ARITHMETIC"VSC2"
with Micro Focus 3.2.24 gives +00000000986.662720.
Without the directive the result is +00000000986.666666.