StringtoDecimal Issue

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
pavankvk
Participant
Posts: 202
Joined: Thu Dec 04, 2003 7:54 am

StringtoDecimal Issue

Post by pavankvk »

Hi

I am reading a file with decimal vales in a column. Reading the column as vachar.

Record 1 : col: 70.4582
Record 2 : col : 1.234 etc

Using StringToDecimal with trunc_zero. and writing to peek as 10,7

I see the output always as 000.0000000
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

StringToDecimal with trunc_zero ?
pavankvk
Participant
Posts: 202
Joined: Thu Dec 04, 2003 7:54 am

Post by pavankvk »

Sainath.Srinivasan wrote:StringToDecimal with trunc_zero ?
I guess thats the default.

Even i specify it or not, i don't see any difference.

When i hard code some string like "1234.456" in the StringtoDecimal, it works fine,but it doesn't work with my input
pavankvk
Participant
Posts: 202
Joined: Thu Dec 04, 2003 7:54 am

Post by pavankvk »

found the issue. its due to 0d hex in the column, took left(col,length(col)-1) and used that as input to stringtodecimal function.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Is that because you're reading a 'DOS' file and not handling the record delimiter properly? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dipanzan
Participant
Posts: 5
Joined: Thu Mar 19, 2009 12:33 pm

Post by dipanzan »

Reading the file as a DOS fomatted file might have solved the problem..
Dipanjan
pavankvk
Participant
Posts: 202
Joined: Thu Dec 04, 2003 7:54 am

Post by pavankvk »

dipanzan wrote:Reading the file as a DOS fomatted file might have solved the problem..
Thanks for reminding, I completely forgot about that.been a while i handled dos files :D
pavankvk
Participant
Posts: 202
Joined: Thu Dec 04, 2003 7:54 am

Post by pavankvk »

dipanzan wrote:Reading the file as a DOS fomatted file might have solved the problem..
Thanks for reminding, I completely forgot about that.been a while i handled dos files :D
Post Reply