Page 1 of 1

PIC S9(9)V99 to Decimal (11,2) Convertion problem

Posted: Mon Nov 13, 2006 4:49 pm
by narasa
Hi,

I am getting problems while converting PIC S9(9)V99 into Decimal (11,2).

I used DatatypePic S9 Transform but i am getting problems with decimal position.For example

For col1 value is 715.00 in source but i am getting 71500.00

Could you please help me on handling PIC S9(9)V99 fields into Decimal (11,2).

I appreciate your help.

Reddy

Posted: Mon Nov 13, 2006 4:56 pm
by ray.wurlod
DataTypePicS9 handles zoned right signed decimal numbers but ignores the scale. The easiest approach is to divide the result by 100.

Code: Select all

DataTypePicS9(InLink.TheColumn) / 100

Posted: Mon Nov 13, 2006 7:55 pm
by reddy
Thank you very much.I got the solution.I appreciate your help.

Thanks
Reddy

Posted: Tue Dec 12, 2006 8:29 am
by thurmy34
Hi All
I wrote a routine called SwitchEBCDICSign to deal with EDBC Sign.
I'm trying to use DataTypePicS9 instead but the result is not exact.

With my routine i have
0000000014052.0L from the CFF ---> -14052,03 (Good Value)
With DataTypePicS9 i have
0000000014052.0L from the CFF ---> -1405,23 (because i have to divide by 100).

Can you help me ?

Posted: Tue Dec 12, 2006 8:42 am
by DSguru2B
DataTypePicS9() expects values without a decimal as far as i remember. Havent used it for quite some time now. Try

Code: Select all

DataTypePicS9(EREPLACE(in.Col, ".", ""))/100
That should take care of it.

Posted: Tue Dec 12, 2006 8:56 am
by thurmy34
You are right DSguru2b.
The values are now correct.

Thanks.

Posted: Thu Dec 21, 2006 9:13 am
by thurmy34
Hi
I just want to warn the DataTypePicS9 users.
The syntax of DSguru2b is correct but you have to pay attention of the input format.
For example:
DataTypePicS9(EREPLACE('715.0{', ".", ""))/100 give you -715.00 and it's right
but DataTypePicS9(EREPLACE('71.5{', ".", ""))/100 give you -7.15 and it's not.