× 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: Jon Erickson <jerickson@xxxxxxx>
  • Date: Fri, 28 Jan 2000 09:24:56 -0800

There is some inherent problems with EVAL's internal computations and Result
field size. I don't recall the exact explanation, I'm sure Barbara or Hans
could, but the following computes correctly:

c                   Eval      Newbal = Begbaldbt - begbalcrt
c                   Eval      Newbal = Newbal - dbt08       
c                   Eval      Newbal = Newbal + crt08       
c                   Eval      Newbal = Newbal - dbt07       
c                   Eval      Newbal = Newbal + crt07       
c                   Eval      Newbal = Newbal - dbt06       
c                   Eval      Newbal = Newbal + crt06       
c                   Eval      Newbal = Newbal - dbt05       
c                   Eval      Newbal = Newbal + crt05       
c                   Eval      Newbal = Newbal - dbt04       
c                   Eval      Newbal = Newbal + crt04       
c                   Eval      Newbal = Newbal - dbt03       
c                   Eval      Newbal = Newbal + crt03       
c                   Eval      Newbal = Newbal - dbt02       
c                   Eval      Newbal = Newbal + crt02       
c                   Eval      Newbal = Newbal - dbt01       
c                   Eval      Newbal = Newbal + crt01       

Regards,
Jon A. Erickson
Sr. Programmer Analyst
800.COM Inc.
1516 NW Thurman St
Portland, OR  97209-2517

Direct: 503.944.3613
Fax: 503.944.3690
Web: http://800.com


-----Original Message-----
From: michael.franchino@cussys.com [mailto:michael.franchino@cussys.com]
Sent: Friday, January 28, 2000 7: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.