×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




So you need to use CVTEFN to do the trick or use the CharToNum proc that
wraps the CVTEFN MI instruction.

Bob Cozzi

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Chevalier, Rick
Sent: Tuesday, March 18, 2003 11:05 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: v5r2 %dec using character argument causing RNQ0105


Dan,

It's the comma.  The following is taken from the RPG reference manual.

*-----------------------------------------------------------------
* If the character data is known to contain non-numeric characters
* such as thousands separators (like 1,234,567) or leading
* asterisks and currency symbols (like $***1,234,567.89), some
* preprocessing is necessary to remove these characters from the
* data.
*-----------------------------------------------------------------
D data s 20a inz('$1,234,567.89')
D num s 21p 9
/free
// Use the %XLATE builtin function to replace any currency
// symbol, asterisks or thousands separators with blanks
num = %dech(%xlate('$*,' : ' ' : data)
: 21 : 9);
// If the currency symbol or thousands separator might
// vary at runtime, use variables to hold these values.
num = %dech(%xlate(cursym + '*' + thousandsSep : ' ' : data)
: 21 : 9);

Rick

-----Original Message-----
From: Dan [mailto:dbcerpg@xxxxxxxxx]
Sent: Tuesday, March 18, 2003 10:38 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: v5r2 %dec using character argument causing RNQ0105

On v5r2, trying to use %dec to convert a numeric expression in an alpha
field to a numeric, but am getting RNQ0105: "A character representation of a
numeric value is in error".  I found no APARs for this.  Any help would be
appreciated!

Here is the relevent code:
  FWIPlist   if   f  132        disk
  FPD14WL#   o    e             disk
  IWIPlist   ns                    
  I                                105  117  wl_@xxxxxx
  I                                118  132  wl_estamt
  C                   Dou       *inLR     
  C                   Read      WIPlist                                LR
  C                   If        not *inLR 
  c                   Select              
  c                   When      wl_@xxxxxx = 'ESTIMATE AMT:'
  c                   Eval      w#_estamt = %dec( %trim(wl_estamt) : 13 : 2
)

Here is the relevent parts of the dump:
 NAME                  ATTRIBUTES           VALUE
 W#_ESTAMT             PACKED(15,2)         0000000000000.00
 WL_@xxxxxx            CHAR(13)             'ESTIMATE AMT:'
 WL_ESTAMT             CHAR(15)             '       3,793.00'
            VALUE IN HEX         '40404040404040F36BF7F9F34BF0F0'X


TIA, Dan

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com _______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





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