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


  • Subject: RE: Eval problems?
  • From: Scott Mildenberger <Smildenber@xxxxxxxxxxxx>
  • Date: Fri, 28 Jan 2000 10:05:04 -0700

Change the eval to eval(r) to force the intermediate calculations to never
have fewer decimal positions than the result.  You can also do this by
putting EXPROPTS(*RESDECPOS)  on the control spec which affects the entire
module.

You should look at this section in the RPG IV Reference about  the precision
rules for numeric operations

http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/QB3AGZ00/4.2.6

Scott Mildenberger

> -----Original Message-----
> From: michael.franchino@cussys.com [SMTP:michael.franchino@cussys.com]
> Sent: Friday, January 28, 2000 8:25 AM
> To:   RPG400-L@midrange.com
> Subject:      Eval problems?
> 
> 
> 
> We are having a problem using an EVAL statement. Below is the EVAL
> statement and
> regular
> RPG computations. The value computed by the EVAL is not correct. This is
> only
> addition and
> subtraction. Why would there be any rounding or truncation??
> 
> All of the fields are (15, 2) Packed.  The value is off by $.72
> 
> The value for EVAL is -239701.00
> The value for the Add/Sub is -239701.72
> 
> Any suggestions???
> 
> 
> D DBT01           S             15P 2 INZ(2411405.68)
> D DBT02           S             15P 2 INZ(3637555.69)
> D DBT03           S             15P 2 INZ(2914468.46)
> D DBT04           S             15P 2 INZ(2467590.42)
> D DBT05           S             15P 2 INZ(2997037.44)
> D DBT06           S             15P 2 INZ(2723494.25)
> D DBT07           S             15P 2 INZ(2897224.41)
> D DBT08           S             15P 2 INZ(3672264.80)
> D CRT01           S             15P 2 INZ(2533251.73)
> D CRT02           S             15P 2 INZ(3507597.50)
> D CRT03           S             15P 2 INZ(2967875.78)
> D CRT04           S             15P 2 INZ(2179784.73)
> D CRT05           S             15P 2 INZ(3242652.68)
> D CRT06           S             15P 2 INZ(2334140.81)
> D CRT07           S             15P 2 INZ(3199573.34)
> D CRT08           S             15P 2 INZ(3745716.75)
> 
> D BEGBALDBT       S             15P 2 INZ(0)
> D BEGBALCRT       S             15P 2 INZ(229253.89)
> 
> D NEWBAL          S             15P 2 INZ(0)
> 
> C                   Eval      NEWBAL = BEGBALDBT - BEGBALCRT -
> C                               DBT08 + CRT08 - DBT07 + CRT07 -
> C                               DBT06 + CRT06 - DBT05 + CRT05 -
> C                               DBT04 + CRT04 - DBT03 + CRT03 -
> C                               DBT02 + CRT02 - DBT01 + CRT01
> 
> C     NEWBAL        DSPLY
> 
> C                   Clear                   NEWBAL
> C                   Add       BEGBALDBT     NEWBAL
> C                   Sub       BEGBALCRT     NEWBAL
> C                   Sub       DBT08         NEWBAL
> C                   Add       CRT08         NEWBAL
> C                   Sub       DBT07         NEWBAL
> C                   Add       CRT07         NEWBAL
> C                   Sub       DBT06         NEWBAL
> C                   Add       CRT06         NEWBAL
> C                   Sub       DBT05         NEWBAL
> C                   Add       CRT05         NEWBAL
> C                   Sub       DBT04         NEWBAL
> C                   Add       CRT04         NEWBAL
> C                   Sub       DBT03         NEWBAL
> C                   Add       CRT03         NEWBAL
> C                   Sub       DBT02         NEWBAL
> C                   Add       CRT02         NEWBAL
> C                   Sub       DBT01         NEWBAL
> C                   Add       CRT01         NEWBAL
> 
> C     NEWBAL        DSPLY
> 
> C                   Seton                                        LR
> 
> 
> TIA
> 
> Michael Franchino
> 
> 
> 
> 
> 
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.