BigInt Problem

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
poonam12
Participant
Posts: 12
Joined: Tue Sep 11, 2007 6:58 am

BigInt Problem

Post by poonam12 »

Hi All,
I have a problem when dealing with bigint values. In my job in a transformer when itry to assign eighteen 9's i.e 999999999999999999 to a BigInt(19) field it rounds the value to 2808348671. How can i pass the original value to output as i could not find any explicit type conversion function. Code isl ike
if length(field)>18 Then 999999999999999999 else field value

so when it reaches the first branch only then there is a problem
dhanashreepanse
Participant
Posts: 25
Joined: Fri Jan 11, 2008 12:49 am
Location: Pune, India

Post by dhanashreepanse »

Hi
Which stage are you using before and after the transformer?
What is the nullability set for that field at the input and output?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What datatype is "field"? Perhaps it is your "if" construct that isn't working. What happens when you explicitly set a bigint(19) to all those 's?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The largest permissible BigInt (int64) value is 9,223,372,036,854,775,807 (2^63-1) in a twos-complement machine. This has 19 digits.

Therefore nineteen "9" characters is not a legal BigInt.

You need to re-think your logic.

Does this "rounding" happen only in View Data, or are you writing the result out to a file or a Peek event? If it is happening only in View Data then the data browser may be treating BigInt as Int.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
poonam12
Participant
Posts: 12
Joined: Tue Sep 11, 2007 6:58 am

Post by poonam12 »

I used following code:
StringToDecimal('999999999999999999')

Now it was not rounded up and correct value was passed.Thanks for your help.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That value only has eighteen "9" characters and is therefore legal as a BigInt.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
poonam12
Participant
Posts: 12
Joined: Tue Sep 11, 2007 6:58 am

Post by poonam12 »

[quote="ray.wurlod"]That value only has eighteen "9" characters and is therefore legal as a BigInt. ...[/quote]

Yeah thats write but if you pass it directly in a BigInt field it is rounded to int32 value by datastage. To retain this value,it need to be passed
1) as a character field
2) using the function StringToDecimal while passing to a BigInt value
Post Reply