Page 1 of 1

How to get exact integer value

Posted: Fri Dec 17, 2010 12:42 pm
by svhari76
Hi All,

I am trying to read data from flat file and looking for record existance in hashedfile(which is populated from DB) . My hashed file contains a numeric field and i am getting it as 3, 4 etc. From the flat file i am getting input as 003, even though i defined the field as smallInt. Because of this my look up fails. How can i convert this 003 value to 3?

I tried using AsInteger function but datastage 7.5.1 doesn't compile.

Can some one help me solving the issue.

Posted: Fri Dec 17, 2010 1:59 pm
by bharathappriyan
Hi,

Could you please check the data type of the column in the file and in the hashed file?

Posted: Fri Dec 17, 2010 2:01 pm
by chulett
Conversions in Server are automatic and thus implicit, so just moving it from the flatfile to a numeric column before the lookup should work fine.

Posted: Fri Dec 17, 2010 2:33 pm
by ray.wurlod
There's no AsInteger() function in server jobs. Please confirm your job type so we don't waste any more time.

Posted: Fri Dec 17, 2010 3:00 pm
by svhari76
I end up being using TRIM function to delete the leading zeros and it works fine now. But if i define SQL data type as smallint,integer it should work but appenrently it did not.

Posted: Fri Dec 17, 2010 9:17 pm
by chulett
Your solution implies that a character field is involved somewhere. Which would also go towards explaining the reason why it didn't work before that. :?