string to decimal conversion

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

sunitha_cts
Participant
Posts: 98
Joined: Thu Feb 05, 2009 1:14 am
Location: visakhapatnam
Contact:

Post by sunitha_cts »

Hi,

My table definiton column is varchar ,and coulmn coming from source in the sense extracted from flat files is char ,so i changed the target value from varchar to char.All this is for only a single column issue


but when i tryed to test in a sample job taking the source table definition column as varchar and source field as char and target as varchar. my record are not load into the target dataset.
Could anyone help on this.

Thanks
sunitha
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'd have to expand a teensy bit on what "could not load" means before anyone could do anything but guess.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sunitha_cts
Participant
Posts: 98
Joined: Thu Feb 05, 2009 1:14 am
Location: visakhapatnam
Contact:

Post by sunitha_cts »

Hi,
The values are somewhat like
000000000782911
0000000813736
000000145
00000898545,

coming from source after doing string to decimal and decimal to string conversion ,the values are losing their least sigificant values

consider the value coming after conversion is 14567.87, it is coming as 14567.8 that means the values above 10000.00 we could not be accurate values,basically when we check in DSmanager the column in field def iS varchar and in source it was char and my target value should be varchar again.we cannot modify the source column datatype we are doing this conversion.

Can u help mein resolving this issue.

Thanks
Sunitha
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Post by dsusr »

Where are you viewing the output. If the target is table check the precision and scale for the column in target table.
sunitha_cts
Participant
Posts: 98
Joined: Thu Feb 05, 2009 1:14 am
Location: visakhapatnam
Contact:

Post by sunitha_cts »

Hi,

source is sequential file and target is a dataset.

1) 100023 is the source value
after conversion
Stringto Decimal(DsLink6.VAR1)/100)->10000.2
DecimaltoString(var1,"suppress zero)->10000.2

2)12345 is source value
after conversion
Stringto Decimal(DsLink6.VAR1)/100)->123.4
DecimaltoString(var1,"suppress zero)->123.45
3)6244544 source value
Stringto Decimal(DsLink6.VAR1)/100)->62445.4
DecimaltoString(var1,"suppress zero)->62445.4


THIS IS MY PROBLEM

Thanks
Sunitha
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

to reiterate:
dsusr wrote:...check the precision and scale...
(and post your settings as well)
sunitha_cts
Participant
Posts: 98
Joined: Thu Feb 05, 2009 1:14 am
Location: visakhapatnam
Contact:

Post by sunitha_cts »

Hi,

For the column is In the table definitio it is varchar 18
source is char 16
target varchar 18.

Thanks
Sunitha
Post Reply