× 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: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Fri, 28 Jan 2000 08:59:40 -0800
  • Organization: Conex Global Logistics Services, Inc.

This is the nature of Eval.  The solution is to set on a switch
in the header, EXPROPTS(*RESDECPOS).

The choices for EXPROPTS are *MAXDIGITS (the default)
or *RESDECPOS (Respect Decimal Positions).  *MAXDIGITS
will adjust the return/hold/temp value of an EVAL expression
up to 30 digits (the maximum) which leaves 0 digits for decimal
places.  If you specify *RESDECPOS, however, it will adjust
it up in digits, but guarantee you that you will always have at least
the same number of decimal digits as in the result of the assignment.

The whole discussion took place in this mailing list, so can't be found
in the archives, unfortunately, but much discussion took place as to
exactly what was going on and why.

Just remember to use EXPROPTS(*RESDECOPOS) in your Header
line and it'll do what you are wanting.

Regards,

Jim Langston

michael.franchino@cussys.com wrote:

> 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
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.