|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Cast Bit to Int Problems |
« View previous topic :: View next topic » |
Author |
Message
|
novice |
Posted: Fri Dec 09, 2005 6:38 am Post subject: Cast Bit to Int Problems |
|
|
Apprentice
Joined: 20 Jun 2005 Posts: 37
|
Hi!
I'm trying to cast a 48-bit data type to a integer:
SET Environment.Variables.A_int = CAST(Environment.Variables.B_bit AS INT CCSID 1252);
I'm getting an error, that the value has an unsuitable source length. See the exception below.
According to the esql reference the INT Datatype ist sized 64 bit.
?
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S500_P\src\DataFlowEngine\ImbRdl\ImbRdlValueOperations.cpp'
(0x03000000):Line = 3410
(0x03000000):Function = 'castBitArrayToInt'
(0x03000000):Type = 'ComIbmComputeNode'
(0x03000000):Name = 'dbselect#FCMComposite_1_2'
(0x03000000):Label = 'dbselect.Compute'
(0x03000000):Text = 'Unsuitable source length'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 2456
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'B'100100000111010001000110000000000000000000000000'' |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Dec 09, 2005 7:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What FP level of version 5 are you using? (You didn't specify, but BIPv500 is a good clue).
What platform? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Fri Dec 09, 2005 8:02 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
ESQL INTEGER is a signed 64bit datatype.
The CAST from BIT to INTEGER requires that the source BIT string be exactly 64 bits in length. Therefore, you will have to pad with leading zeros (possibly taking the MSB- sign bit into account). Note that this CAST function also assumes the bits are laid out in big-endian format. If your string is little endian you will have to reverse it, again taking the sign into account if necessary.
In the simple (non-sign extended, big endian) case this can be achieved by using the REPLICATE function to replicate a bit string containing a single 0 bit to be 64 bits long. You can then use the OVERLAY function to overlay your 48bit string over the top of the 64 bit string of zeros.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|