AsInteger conversion data 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
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

AsInteger conversion data issue

Post by Roopanwita »

Hi,

I have source column float datatype mapped to Integer in target. I used AsInteger function in transformer to convert Float to Integer , as without conversion job was failing as I was mapping float to Integer.

After explicitly converting Float to Integer in target table field value is coming with negative sign e.g. source value :123 target value -123.

When I searched in forum, I got a post saying it is due to data over flow.

I checked table data( length of the column) It has maximum length 10 and I am running the process with very few records, so I made sure record length <=10.

Can anyone please let me know the reason.

Thank you in advance.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

if your source is truly 123 i see no reason for data overflow for integer target. Is this happening for every record ? could you share more information regarding source and target stages ? give a try by making the integer column unsigned and see what happens .
- Zulfi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you sure that the job is failing due to overflow? Or is it that you are getting a warning that mapping float to integer may cause overflow, and the actual cause of failure is something else?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Thank you for response.

Yes, when I am mapping float source datatype to Integer in Target (I used a Copy stage in between) , it is giving error that, you are mapping float to int32 which might truncate data and job is failing failing. So I used AsInteger conversion .

Value in output is consistently coming negative, my question is why it is converting source value to negative value in target.

If I change target table to decimal (10,0) or float it gives proper value .

Please let me know if there is any solution of this issue.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not all ten digit numbers can be integers. The largest possible signed integer is 2147483647, the largest unsigned integer is 4294967295. It's that fact that triggers the alert message. Any number larger than these will wrap around and be reported as negative. What are your actual values?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Thank you for response , I changed datatype of target table from Integer to Float and it is working.

Thank you.
Post Reply