× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.