Solved

RPGLE Eval div vs. DIV Operation on Calc

Posted on 2013-06-01
4
470 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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.

751 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