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



Angela,

Are there one, two, or three distinct '9,5' fields?

If one, I don't understand why you are getting an error.

If different fields, then you will get the error if the result of the
"divide/2000" is smaller than 1/10,000th of the other quotient.

Are your thinking that eval(r) means eval("round")?
Try using eval(h) ("half adjust") to round the decimal positions.

If this doesn't resolve the issue, please post the code (as opposed to a
description of the code) and I will see if anything else pops out.

HTH

Tim Kredlo


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Angela Wawrzaszek
Sent: Friday, July 01, 2005 11:24 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: The target for a numeric operation is too small to hold
theresult


EVAL(R) was just an attempt,  as I couldn't find any other documentation
that would allow me to do it.

I have a   9,5   field   divided by  a (9,5 field/2000)   so the result
could have a large number of decimals,   I do not have to display this.
This is a cost per ton  so the field only needs to go out 2 decimal places.
I keep getting the target error and am assuming it is because
my result field is also 9,5?   You are saying the eval shouldn't bomb
and should drop the decimals?

Once I created a work field of  25,21  I had no issues,  then moved this
field to my display field of 9,5.   So I believe dropping the decimals
greated than the 5th position must have been a problem.

Angela Wawrzaszek
IT Supervisor
Nucor Steel Auburn
(315) 258-4205
awawrzaszek@xxxxxxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Friday, July 01, 2005 2:07 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: The target for a numeric operation is too small to hold the
result


> How do I get around this error using the eval statement?  I DO NOT
want
> to make the field bigger,  I just want to truncate the extra decimals.

Huh? Do you mean that you want to truncate the extra digits?  Truncating

extra decimals is not necessary, it happens automatically.

For example, the following code won't receive any errors, in spite of the 
fact that it drops a decimal place:

      D A               s              5P 1
      D B               s              5P 1
       /free
           a = 0.5;
           b = a / 2;

> It is a complex equation,  which I then push the result to a display 
> field,  so to determine the max field size will be difficult,  plus I 
> then have to move the 'temp' field to a display field.

If the max field size is a really big issue for you and you don't care 
about losing accuracy (which is very unsual for an RPG programmer, I might 
add!) you might consider using floating point fields.  They allow for 
extremely huge numbers or extremely low numbers without a need to know 
ahead of time how many digits/decimals are needed.

The drawback is that they can lose accuracy. The result will be close, but 
might not be exact.  Since you're not worried about digits being lost, I

assume that you don't care if your result is exact -- so this might be a

good solution.

> I just want to ignore the extra decimals!   I tried eval(r)    also
and
> still get the same errors

I don't understand what eval(r) has to do with your question.  Are you 
having trouble with an intermediate result?  If that's the case, you could 
try using %DEC() to control the intermediate result size.

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.