Problem writing Float to Sybase

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
sri1dhar
Charter Member
Charter Member
Posts: 54
Joined: Mon Nov 03, 2003 3:57 pm

Problem writing Float to Sybase

Post by sri1dhar »

Source is sequential file varchar datatype. Althought its decimal, I am reading as varchar and converting in the transofrmer to decimal.

Target is Sybase float datatype.

source_value = 499000
My transform is: stringtodecimal(source_value)/100000

result should have been 4.99,
but in the table the value is written as: 4.98999768511111.

I tried DecimaltoDfloat(stringtodecimal(source_value)/100000), still same result.

When I do a Peek on the same, value is shown as 4.99

I have seen several posts on the forum where float datatype is an issue. There are posts suggesting using DFloatToStringNoExp to read floats, but couldn't find anything on writing float datatype to the database. Your help is greatly appreciated.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
What is the meta data of the DS column definition and the target table definition?
what is set in environment variable that effect the precisoin both for DS and Sybase?
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
sri1dhar
Charter Member
Charter Member
Posts: 54
Joined: Mon Nov 03, 2003 3:57 pm

Post by sri1dhar »

roy wrote:Hi,
What is the meta data of the DS column definition and the target table definition?
what is set in environment variable that effect the precisoin both for DS and Sybase?
Target sybase column datataype is float.
DS column is float (15). It I change DS column from float to decimal I get a run-time error and the job aborts. So I had to stick with float.

APT_DECIMAL_INTERM_SCALE = 10 is for this project.

I was able to fix this issue by using BASIC transformer and SybaseOC stage (instead of Parallel Transformer & Sybase Enterprise stages) and changing DS column metadata to Decima (15,5).
Post Reply