BigInt To Integer 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

Post Reply
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

BigInt To Integer conversion

Post by gauravrb »

Is BigInt to Integer implicit conversion possible?

I want to convert number BigInt(10) to Integer(10)

I tried using AsInteger Typecasting function but then to it was giving negative value in the output as it was earlier during implicit conversion.

Is it possible to conver as follows BigInt------>Decimal------->Integer?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What is the value that you are trying to convert?
If the value is beyond 2^16-1, the value might diverted to negative value.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

The value that iam trying to convert is autogenerated 10 didgit BigInt number
i.e. 3000000000.

I tried converting it to decimal implicitly, it worked but when i tried assingning that decimal to integer it gave me fatal error "Transformer_10,0: Fatal Error: APT_Decimal::asInteger: the decimal value is out of range for the integer result."

Is there any other way to covert it into integer?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The largest permissible int32 (Integer) value is 2^31-1, or 2,147,483,647.

Your generated number (3,000,000,000) is larger than this, hence the error.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gauravrb
Participant
Posts: 28
Joined: Wed Dec 27, 2006 11:31 pm
Location: Mumbai

Post by gauravrb »

Yes that is right.

The number is greater than 3000000000

So i guess the target datatype must be changed or take some lesser values.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Oh yeah, I was referring to SmallInt that too with an error. SmallInt will be int16 and hence 2^15-1 (1 for sign).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

gauravrb wrote: So i guess the target datatype must be changed or take some lesser values.
Do you mean to say, should be changed to take some more values.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply