Page 1 of 1

converting char amount fileds to numeric

PostPosted: Tue Nov 01, 2011 7:02 pm
by prasad75
Hi,

I would like to convert to X(17) amount value to PIC S9(15)V9(02).

Amount value from input file is 12345.99

i need to convert it into PIC S9(15)V9(02).

Please advise.

thanks

Re: converting char amount fileds to numeric

PostPosted: Tue Nov 01, 2011 8:45 pm
by BillyBoyo
Have a look at the Cobol intrinsic function NUMVAL in the manuals.

Re: converting char amount fileds to numeric

PostPosted: Tue Nov 01, 2011 9:51 pm
by dick scherrer
Hello,

I would like to convert to X(17) amount value to PIC S9(15)V9(02).
Amount value from input file is 12345.99
I suspect one of these is in error. . . If there is a decimal point in the value, then the x(17) would be x(18) or the most significant digit would be truncated.

Will there always be 2 decimal places or might the number vary?

Re: converting char amount fileds to numeric

PostPosted: Wed Nov 02, 2011 12:54 pm
by prasad75
good catch. yes, it is X(18). There will always be 2 decimal places.

Re: converting char amount fileds to numeric

PostPosted: Wed Nov 02, 2011 1:04 pm
by BillyBoyo
Is the number right-aligned? If yes, you can do it without NUMVAL, otherwise did you look into that?