Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RPGLE Eval div vs. DIV Operation on Calc

Posted on 2013-06-01
4
Medium Priority
?
499 Views
Last Modified: 2013-06-04
I recently changed a piece of coding to free-form.

Field1    DIV    2.250               Result

eval      Result = Field1 / 2.205


The free-form line gets an error - The target for a numeric operation is too small to hold the result when Field1 is 377872, but the original does not.  The Result field is defined as 7.2

Does anyone know why this is, and can the error be avoided?
0
Comment
Question by:nickmbnabb
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:DOSLover
ID: 39213114
The EVAL statement with Half-Adjust should solve your problem:
       eval(h)      Result = Field1 / 2.205 ;
0
 

Author Comment

by:nickmbnabb
ID: 39214230
I tried that....still get the same error msg.
0
 
LVL 5

Accepted Solution

by:
DOSLover earned 2000 total points
ID: 39215101
With Field1=377872, value of Field1/2.205 = 377872/2.205 = 171370.521451... which means 7,2 will not be big enough to hold the result. Please try with result field of 9,2.
0
 

Author Comment

by:nickmbnabb
ID: 39215860
Yes, that did work.  Thank you.  Yet I still wonder why the original non-freeform coding was able to handle the truncating, while the free-form needed the field to be expanded.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question