TPump error - 2683 Numeric overflow occurred during computation.

Tools
Enthusiast

TPump error - 2683 Numeric overflow occurred during computation.

Hi,

I am using a Java program to write dat ( binary ) file to be loaded by TPump script.

For "Decimal" column type, here is how I write the data:

aValue = ((BigDecimal) aValue).movePointRight(((BigDecimal) aValue).scale());

aValue = ((BigDecimal) aValue).toBigInteger();

byte[] integerBytes = aValue.toByteArray();

int paddingLength = len - integerBytes.length;

// integerBytes always in big endian (see BigInteger.toByteArray())

if (!BIG_ENDIAN)

{

for (int i=(integerBytes.length - 1); i >= 0; i--)

{

dataBuf[dataOff++] = integerBytes;

}

}

else

{

System.arraycopy(integerBytes, 0, dataBuf, dataOff, integerBytes.length);

dataOff += integerBytes.length;

}

... do the padding and write buffer to file

Now the problem is For a column type Decimal(8,2) I am getting 2683 error - but only when I run on AIX, with TPump failing to insert afert first few records and ERROR table shows 2683 error, whereas on windows it works fine.

Forgot to add that this is due to difference in ByteOrder ( windows is LittleEndian and AIX is BigEndian)

How can I modify above to work consistently, w.o affecting other data types.

Thanks.
1 REPLY
Enthusiast

Re: TPump error - 2683 Numeric overflow occurred during computation.

ok..i got it fixed.. for others' reference, the above code has a bug..
for a column defined Decimal(8,2) - tpump expects 4 bytes of number.

when I use some value that can fit in 2 bytes , BigInteger("1024").toIntegerBytes will return only two bytes (e.g. 1024 = 04 00 in big endian), :
This code generates 4 byte representation by padding additional 00 or FF as:
00 04 "00 00" ( little endian) [RIGHT for 1024]
04 00 "00 00" (big endian) [WRONG for 1024]
(the bytes in quotes are padded to make it 4 byte)
in case of little endian it is ok to pad the bytes to right, in case of big, it should have been on the left.. and correct form would be:
00 00 04 00.