Solved

RPGLE Eval div vs. DIV Operation on Calc

Posted on 2013-06-01
4
438 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
withoutString  challenge 40 177
mapShare challenge 13 88
Is there a canned solution for a custom genealogy website 2 79
Problem to open text file 11 67
This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This video teaches viewers about errors in exception handling.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now