gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] What should this produce ?


From: Sergey Kashyrin
Subject: Re: [open-cobol-list] What should this produce ?
Date: Mon Apr 3 14:46:09 2006

Roger,

MFocus with NOTRUNC is doing the same as mainframe with TRUNC(BIN).
They are just trying to keep mainframe compatibility (at least in case of OSVS 
or IBMCOMP option)

source is
123456123456000 == 0x000070485E624A00
the precise multiplication result is
15241414418783113383936000000
converting to 9(n).9(9) (stripping off the right 9 digits, i.e. dividing by 
1000000000)
15241414418783113383
The HEX value of the result is 0xD38461A9521590A7 which is exactly what we get 
on mainframe.
The rest is just an interpretation of the result as negative vs positive.

Didn't check how OC got its result yet :-)

Regards,
Sergey


----- Original Message ----- From: "Roger While" <address@hidden>
To: <address@hidden>
Sent: Monday, April 03, 2006 9:08 AM
Subject: [open-cobol-list] What should this produce ?


As per title :

       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      MYPROG.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
       01  R1   PIC 9(9)V9(9)       VALUE 123456.123456.
       01  R2   PIC 9(9)V9(9)       VALUE 123456.123456.
       01  R3   PIC S9(9)V9(9)      VALUE 0.

       01  R4   PIC 9(9)V9(9)  COMP VALUE 123456.123456.
       01  R5   PIC 9(9)V9(9)  COMP VALUE 123456.123456.
       01  R6   PIC S9(9)V9(9) COMP VALUE 0.

       01  R7   PIC S9(12)V9(6).
       PROCEDURE        DIVISION.
       A-START.
           MULTIPLY R1 BY R2 GIVING R3.
           DISPLAY R3.

           MULTIPLY R4 BY R5 GIVING R6.
           DISPLAY R6.

           MOVE R6 TO R7.
           DISPLAY R7.

           ADD 1 TO R6
           DISPLAY R6.

           MOVE R6 TO R7.
           DISPLAY R7.

           STOP RUN.

Note for OC, you will need one of the "-std=" options
mvs, ibm, mf, bs2000.

MF produces a very interesting result (SE 2.2 and 4.0)
(NOTRUNC doesn't affect it and neither does DIALECT=)

Roger
Roger




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]