ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Cast Bit to Int Problems

Post new topic  Reply to topic
 Cast Bit to Int Problems « View previous topic :: View next topic » 
Author Message
novice
PostPosted: Fri Dec 09, 2005 6:38 am    Post subject: Cast Bit to Int Problems Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Dec 09, 2005 7:03 am    Post subject: Reply with quote

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
View user's profile Send private message
mgk
PostPosted: Fri Dec 09, 2005 8:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Cast Bit to Int Problems
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.