Topic
  • 5 replies
  • Latest Post - ‏2013-07-12T11:35:18Z by Hsieh
Brthsyn
Brthsyn
3 Posts

Pinned topic FormatNumber Problem

‏2013-07-11T12:59:55Z |

Hi,

 I have a problem about format numeric values.

I want to convert int to string with EGL.

myint = 5000,23

result = strLib.formatNumber(myint , "<<<,<<<,<<<,<<<,<<<.<<");

I wanna see the result like that

Result :                  5,000.23

But ELG returns     5.000,23       seperators (comma and dot) is not correct.

Anybody  knows how to solve this problem?

I use RBD 8.0.1.2

  • Sune
    Sune
    10 Posts

    Re: FormatNumber Problem

    ‏2013-07-11T13:42:30Z  

    Hi Berat

    I think you should search the documentation for decimalSymbol and separatorSymbol.

    Best,

    Sune

  • Brthsyn
    Brthsyn
    3 Posts

    Re: FormatNumber Problem

    ‏2013-07-11T13:59:46Z  
    • Sune
    • ‏2013-07-11T13:42:30Z

    Hi Berat

    I think you should search the documentation for decimalSymbol and separatorSymbol.

    Best,

    Sune

    Hi Sune,

    I look this topic and try numeric formatting symbols on the table but I can not solve my problem. Can you send me a link about this topic if you have? http://publib.boulder.ibm.com/infocenter/rbdhelp/v7r5m0/index.jsp?topic=/com.ibm.egl.lr.doc/topics/regl_apdx_num_format.html

    Updated on 2013-07-11T14:00:05Z at 2013-07-11T14:00:05Z by Brthsyn
  • Hsieh
    Hsieh
    610 Posts

    Re: FormatNumber Problem

    ‏2013-07-11T15:21:24Z  
    • Brthsyn
    • ‏2013-07-11T13:59:46Z

    Hi Sune,

    I look this topic and try numeric formatting symbols on the table but I can not solve my problem. Can you send me a link about this topic if you have? http://publib.boulder.ibm.com/infocenter/rbdhelp/v7r5m0/index.jsp?topic=/com.ibm.egl.lr.doc/topics/regl_apdx_num_format.html

    Hi Berat,

    You must setup the EGL Build Descriptor and and choose one of the form below:

     

    1. set targetNLS = ENU or another

    2. set decimalSymbol = ,   and   separatorSymbol = .

    I did a sample and work fine:

     

    mydec decimal(9,2)= 5000.23;

    SysLib.writeStdout("mydec: " + mydec);

     result string = StrLib.formatNumber(mydec, "<<<,<<<,<<<,<<<,<<<.<<");

    SysLib.writeStdout("result: " :: result);

    ---------------------

    mydec: 5000.23

    result: 5,000.23

     

    Regards,

     

    Hsieh

  • Brthsyn
    Brthsyn
    3 Posts

    Re: FormatNumber Problem

    ‏2013-07-12T06:31:46Z  
    • Hsieh
    • ‏2013-07-11T15:21:24Z

    Hi Berat,

    You must setup the EGL Build Descriptor and and choose one of the form below:

     

    1. set targetNLS = ENU or another

    2. set decimalSymbol = ,   and   separatorSymbol = .

    I did a sample and work fine:

     

    mydec decimal(9,2)= 5000.23;

    SysLib.writeStdout("mydec: " + mydec);

     result string = StrLib.formatNumber(mydec, "<<<,<<<,<<<,<<<,<<<.<<");

    SysLib.writeStdout("result: " :: result);

    ---------------------

    mydec: 5000.23

    result: 5,000.23

     

    Regards,

     

    Hsieh

    Hi Hsieh, first of all thanks your answer.

    I looked build desciriptor and it is like that :

    targetNLS="ENU" , decimalSymbol="," separatorSymbol="." 

    But I didnt understand why decimalSymbol = ,  and separatorSymbol = .  is

    I wanna see "." before decimal part of number So it must be decimalSymbol = "." isn't  it?

    How your desciriptor works correctly when your decimal option is ","

     

  • Hsieh
    Hsieh
    610 Posts

    Re: FormatNumber Problem

    ‏2013-07-12T11:35:18Z  
    • Brthsyn
    • ‏2013-07-12T06:31:46Z

    Hi Hsieh, first of all thanks your answer.

    I looked build desciriptor and it is like that :

    targetNLS="ENU" , decimalSymbol="," separatorSymbol="." 

    But I didnt understand why decimalSymbol = ,  and separatorSymbol = .  is

    I wanna see "." before decimal part of number So it must be decimalSymbol = "." isn't  it?

    How your desciriptor works correctly when your decimal option is ","

     

    Hi Berat,

    My apologies.  I wrote wrong.  I had only run with the option targetNLS = ENU. 

    The correct is  decimalSymbol = .   and   separatorSymbol = ,

    but it's necessary only if you want to overwrite Cobol Runtime configuration or generated to Java or to run Debug.

    you could choose one:

    1. set targetNLS = ENU or another

    2. set decimalSymbol = .   and   separatorSymbol = ,

    3. or both 1 and 2.

     

    Hsieh