From: on
In article <11u49a7op2fho6a(a)corp.supernews.com>,
Rick Smith <ricksmith(a)mfi.net> wrote:
>
>"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

[snip]

>> *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.

Gotta love this Web-thingie... from
http://docs.hp.com/cgi-bin/doc3k/BB243390006.13011/20 :

--begin quoted text:

* You can now give a compiler directive (ARITHMETIC"VSC2" or
ARITHMETIC"OSVS") which ensures the program will give results
compatible with IBM mainframes in arithmetic statements. Up until
now arithmetic statements have used Micro Focus's algorithms for
the accuracy of results (generally determined by the way
intermediate results in arithmetic statements are stored). With
this release the algorithms used are selectable at compile time.
A simple example of where behavior can be different is:

01 work-index pic 9
...
compute work-index = ( 7 / 4 ) * 4.

The mainframe compilers will return the result 4; Micro Focus has
always returned the result 7. This is because on the mainframe
the intermediate result of the division (1.75) is stored in a PIC
9 field so it becomes 1.

Results in Micro Focus COBOL may still differ from results on the
mainframe, if the intermediate result requires more than 20 digits
before, or more than 20 digits after, the decimal point,

--end quoted text.

DD

From: William M. Klein on
That "arith" directive is FAR from new. In fact, I remember when I was still
working (for Micro Focus) and wrote those exact words that DD quoted for the
"Mainframe compatibility Guide" - and I went on disability in 1996).

FYI,
For anyone wanting to know HOW IBM (currently supported compilers) determines
intermediate results, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg30/APPENDIX1.1

as far as the rules of COBOL go (before the '02 Standard introduced "ARITHMETIC
IS STANDARD") the implementor was free to do WHATEVER they wanted with such
cases. Even with the "new" ARITHMETIC clause, many calculations are still
implementor defined.

--
Bill Klein
wmklein <at> ix.netcom.com
<docdwarf(a)panix.com> wrote in message news:drte5n$993$1(a)reader2.panix.com...
> In article <11u49a7op2fho6a(a)corp.supernews.com>,
> Rick Smith <ricksmith(a)mfi.net> wrote:
>>
>>"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
>
> [snip]
>
>>> *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.
>
> Gotta love this Web-thingie... from
> http://docs.hp.com/cgi-bin/doc3k/BB243390006.13011/20 :
>
> --begin quoted text:
>
> * You can now give a compiler directive (ARITHMETIC"VSC2" or
> ARITHMETIC"OSVS") which ensures the program will give results
> compatible with IBM mainframes in arithmetic statements. Up until
> now arithmetic statements have used Micro Focus's algorithms for
> the accuracy of results (generally determined by the way
> intermediate results in arithmetic statements are stored). With
> this release the algorithms used are selectable at compile time.
> A simple example of where behavior can be different is:
>
> 01 work-index pic 9
> ...
> compute work-index = ( 7 / 4 ) * 4.
>
> The mainframe compilers will return the result 4; Micro Focus has
> always returned the result 7. This is because on the mainframe
> the intermediate result of the division (1.75) is stored in a PIC
> 9 field so it becomes 1.
>
> Results in Micro Focus COBOL may still differ from results on the
> mainframe, if the intermediate result requires more than 20 digits
> before, or more than 20 digits after, the decimal point,
>
> --end quoted text.
>
> DD
>


From: Lee on
Thanks for the answers everyone.

BTW the answer in Fujitsu is the same even when all operands are (11)v(7).
You can achieve the (correct) result by re-ording the operations so that
division is done last.

Lee