gnucobol-users
[Top][All Lists]
Advanced

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

RE: [open-cobol-list] Numeric field issue and mpz_add


From: Bill Klein
Subject: RE: [open-cobol-list] Numeric field issue and mpz_add
Date: Fri Jan 28 16:42:28 2005

This is just "off the top of my head" and I haven't checked the '85 or '02
Standards, but I *think* that when you do any arithmetic (as opposed to
MOVE) statement and an "on size error" condition occurs but no ON SIZE ERROR
phrase is specified, that "results are unpredictable" for the receiving
fields, e.g.

  05  Num1  Pic 9 Value 9.
  05  Num2  Pic 99 Value 98.
        ...

add 1 to Num1 Num2
Display "why didn't I put an OSE phrase here?"

that Num2 will (be guaranteed) to have 99 - but that Num1 can have ANYTHING
in it, i.e. 9, 0, or "A".

I'll check on this later (for the Standard rules) but that is my VAGUE
memory. 

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On 
> Behalf Of Tim Nixon
> Sent: Friday, January 28, 2005 10:52 AM
> To: address@hidden
> Subject: [open-cobol-list] Numeric field issue and mpz_add
> 
> Hello:
> I have a situation: if there is a numeric PIC field of width 
> 10 or more,
> ie:05 Var7 PIC S9(3)V9(8)and it is about to overflow (for example: the
> variable Var7 has the value 999.9 and we're adding 1) then 
> the result is
> still 999.9. If the field width is less than 10 digits total, 
> then adding 1
> in the example above yields 000.9.
> It appears that this is related to the use of the mpz_add function.
> Is there a way to avoid this? On the mainframe (IBM) adding 1 to 999.9
> (assuming the whole number part is 3 digits wide) always 
> yields 000.9 no
> matter what the total field width is.
> 
> Thanks
> Tim Nixon
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive 
> Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> 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]