StringToDecimal - how to avoid to Rounding

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
anu123
Premium Member
Premium Member
Posts: 143
Joined: Sun Feb 05, 2006 1:05 pm
Location: Columbus, OH, USA

StringToDecimal - how to avoid to Rounding

Post by anu123 »

I have source field geocode and value as below..
source - Geocode = 40.145000|-84.24860

I need to parse above value into Latitude & Longitude

Latitude = 40.145
Longitude = -84.2486

I am using below transformations

Latitude = StringToDecimal(Field(geocode,"|",1))
Longitude = StringToDecimal(Field(geocode,"|",2))

The outpur I am getting is

Latitude = 40.145
Longitude = -84.249

I tried using using RTYPE option 'floor' on StringToDecimal but values are getting truncated.

Is there a way to convert string to decimal with any kind of rounding..
Thank you,
Anu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Specify a larger scale value than 3.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
anu123
Premium Member
Premium Member
Posts: 143
Joined: Sun Feb 05, 2006 1:05 pm
Location: Columbus, OH, USA

Post by anu123 »

ray.wurlod wrote:Specify a larger scale value than 3.
Thanks Ray.

I have specified Decimal(31,10). Even though it is getting rounded.
Thank you,
Anu
Post Reply