|
Hans, with great respect I say your answer blames the victim. This is a possibility for many programs converted to RPG IV, and it's not necessarily a "logic" error. You're asking us to EVALuate every line of converted code and consider if a numeric overflow could occur. I haven't had many overflows, but I've had enough to know it's a pain. The manner in which RPG IV presents this error is unfriendly, and IMHO this issue is one of the biggest reasons people aren't moving to RPG IV and ILE RPG. I think this issue needs some consideration in the Lab. Regards, Reeve -----Original Message----- From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On Behalf Of boldt@ca.ibm.com Sent: Thursday, December 06, 2001 10:05 AM To: rpg400-l@midrange.com Subject: Re: Target for numeric operation too small John wrote: >Forgive me if this is a stupid question. I am relatively new to RPG IV >(RPG/400 Veteran). I occasionally get the error "Target for numeric >operation too small to hold result" when my result field is too small. Is >there anyway to avoid getting this error besides the obvious, "make my >result field larger". Yes, there is a way to avoid getting the overflow exception: Fix the logic errors in your program that are causing the numeric overflows. RPG III was too "kind" in that it did not tell you when your numerics overflowed, and instead quietly truncated values. If you really do need your numerics truncated (and I really can't think of any situation where truncation might be useful and there isn't a better alternative), convert your numeric value to character using something like %EDITC(...:'X') and %SUBST the desired number of right-most characters. Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.