c2n2 function ignores any character other than 0 thru
9 and . , -

So the following would work where ',' is used as the
decimal point. Not the best solution but it should
work.

str = '1.234,5'
number = c2n2(%xlate('.': 'x': str))

Convert the '.' to an 'x' as c2n2 will ignore the
invalid character.


--- Enrico Amisano <[EMAIL PROTECTED]> wrote:

> Mel
>  
> Many Thanks for your suggestions.
>  
> But I know that C2N2xxxx subprocedure doesn't exist,
> it was only an example.
>  
> My big problem is that I don't know well Rpg ILE and
> %DEC and %DECH BIF for
> me are new.
>  
> Now with %dec I have resolved my problems.
>  
> Many Thanks to ALL !!
>  
>  
> 
> Enrico Amisano
> 
> Servizio EDP
> 
> Guala Dispensing Spa
> 
> Zona Industriale D5
> 
> 15047 Sobborgo Spinetta Marengo (AL)
> 
> Email: [EMAIL PROTECTED]
> 
>  
> 
> -----Messaggio originale-----
> Da: [email protected]
> [mailto:[EMAIL PROTECTED] Per
> conto di Mel Rothman
> Inviato: giovedì 22 dicembre 2005 15.10
> A: [email protected]
> Oggetto: Re: [Easy400Group] Suggestions for C2N2
> subprocedure
> 
> 
> C2N2 returns a packed decimal 30,9 value.
> 
> There is no subprocedure C2N2xxxx, so the statement
> " A=C2N2xxx('123.5')"
> shouldn't work at all. 
> 
> The correct subprocedure name is C2N2.
> 
> From here on, I'll assume you are using CGIDEV2's
> C2N2 subprocedure.
> 
> C2N2 figures out what the decimal character is. If
> it is a comma, it treats
> a period as a character to be ignored.  
> 
> If the decimal point is a comma, C2N2 converts
> '123.5' to 1235 and '123,5'
> to 123.5.
> 
> For details about C2N2, read its prototype in
> CGIDEV2/QRPGLESRC member
> PROTOTYPEB.
> 
> For even more detail, read its code in
> CGIDEV2/QRPGLESRC, member XXXDATA.
> You will find that the first thing C2N2 does is
> figure out what the decimal
> point is.
> 
> To find out what your job's decimal point is, use
> DSPJOB OPTION(*DFNA).
> Page down to "Decimal format."  If decimal format is
> *BLANK, the decimal
> point is a period. If it is J or I, it is a comma. 
> Also see the system
> value QDECFMT.
> 
> 
> Mel Rothman, CGIDEV2 Author
> Mel Rothman, Inc.
> 
> eamisano wrote:
> 
> 
> Hi to ALL and Merry Christmas to you.
> 
> I have a program with about 30 input numeric fields.
> Decimals can be:
> - none
> - 1 or 2 or 3
> 
> My problem is that with the C2N2 subprocedure I can
> transform easely 
> char variable into decimal but the transformation
> returns an integer 
> value.
> For example: if I want to transform 123.5 the result
> will be 1235,
> not 123,15 in decimal.
> Probably I haven't understood the C2N2 subprocedure
> but I haven't 
> read nothing about it.
> My problems grow since decimals are not fixed in the
> form and until 
> now I use this solution:
> to test where is the point (.) in the char variable
> and find the 
> decimal numbers on the right of the variable.
> 
> My question is:
> do you know if there is any kind of subprocedure
> that allows me to 
> return directly a numeric value with decimals from a
> char ?
> Example:
> 
> A=C2N2xxx('123.5') return 123,5 numeric ?
> 
> Many thanks in advance.
> 
> 
> 
> 
>   _____  
> 
> YAHOO! GROUPS LINKS 
> 
> 
>       
> *      Visit your group "Easy400Group
> <http://groups.yahoo.com/group/Easy400Group> " on
> the web.
>   
> 
> *      To unsubscribe from this group, send an email to:
>  [EMAIL PROTECTED]
>
<mailto:[EMAIL PROTECTED]>
> 
>   
> 
> *      Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/> . 
> 
> 
>   _____  
> 
> 
> 



                
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/wbFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Easy400Group/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to