• Subject: Re: Overflow values
  • From: boldt@xxxxxxxxxx
  • Date: Tue, 22 Dec 1998 09:39:17 -0500



Hi Rajeev!  That won't work since numeric overflow is
always signalled for numeric expressions.  TRUNCNBR(*YES)
is offered only for compatibility with older programs.
Truncation is an option only for the fixed-form arithmetic
ops and only for the decimal numeric data types: packed,
zoned, and binary.

For various reasons, numeric overflow is always signalled
for newer features, such as expressions and the integer
data types.

BTW, if you get an unexpected numeric overflow exception
in your program, never, Never, NEVER fix it by changing
TRUNCNBR(*NO) to TRUNCNBR(*YES).  If the program was
compiled with *NO, it was for a reason.  That reason was
to help you discover bugs in your program.  TRUNCNBR(*YES)
may get rid of the numeric overflow exception, but you'll
then have an even bigger job ahead of you to fix the errors
that show up in your program.  The worst case is that you
won't see a problem, but your customers will get incorrect
bills!

Cheers!  Hans

Rajeev wrote:
>Hi Sudha,
>
>It may be that your program has been compiled using option
>TRUNCNBR(*NO).
>Change it to *YES and I hope you won't get overflow error.
>
>Thanks,
>
>Rajeev.
>
>From: "Sudha Ramanujan" <sramanujan@sungardfutures.com>
>To: <MIDRANGE-L@midrange.com>
>Subject: Overflow  values
>Date: Tue, 8 Dec 1998 14:39:03 -0600
>Reply-To: MIDRANGE-L@midrange.com
>
>Hi all,
>
>While using EVAL for computing numbers, if the result of computing gets
>larger than the result field definition, the throws up an error.  Is there
>any way to get around this?  Like say truncate (as it does in Move) some
>EVAL(T)?? :)  If I use *PSSR, the program goes to the top of the line
>and I
>loose all the work that is done till then.
>(Right now, am using a very large number for computation and comparing
>that
>with *hival of the defined number and then if larger, moving hival!
>Would prefer a much smarter way to do this.)

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.