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




Reply via email to