× 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.



Ted Barry wrote:
> 
> The result is -226.565217391304347826086956521739 and eval(r) didn't work.  
> Wouldn't rounding work and prevent an error?

Ted, your result field is a 5,3 (xx.xxx).  Rounding only handles digits
to the right of the decimal point; it doesn't truncate digits to the
left of the decimal point.

eval(r) doesn't usually correct truncation situations - it usually
corrects situations where decimal positions are dropped from the result
(say giving an answer of 12.000 rather 12.263).

There is no H spec keyword or operation extender that will stop your
eval from overflowing.

Do you really want the result of that calculation to be -26.565 instead
of -226.565?  If so, the easiest way to get that is to use the DIV
opcode.  The second easiest way is to use a data structure overlay:

D            DS
D  ltdpct6            6s 3
D  ltdpct             5s 3   overlay(ltdpct6:2)

       eval(h) ltdpct6 = actltd / actbud

If you don't want to change the size of the result field but you don't
really care about the result value when the overflow occurs, try this,
setting it to zero when it overflows:

   monitor
      eval(h) ltdpct = actltd / actbud      
   on-error
      eval    ltdpct = 0
   endmon

> ...
> > -----Original Message-----
> > From: Ted Barry [mailto:TBARRY@xxxxxxxxxxxxxxxxxxxx]
> > Subject: The target for a numeric operation is too small to hold the
> > result
> >
> >
> > I recently converted an rpg/400 program to rpg iv and am
> > having the following problem.
> >
> > d ltdpct          s              5  3
> >


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.