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

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
narasa
Participant
Posts: 2
Joined: Tue Nov 30, 2004 11:48 am

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

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Thank you very much.I got the solution.I appreciate your help.

Thanks
Reddy
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post 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 ?
Hope This Helps
Regards
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

You are right DSguru2b.
The values are now correct.

Thanks.
Hope This Helps
Regards
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post 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.
Hope This Helps
Regards
Post Reply