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 » broker 7 function or operator similar to java << opera

Post new topic  Reply to topic
 broker 7 function or operator similar to java << opera « View previous topic :: View next topic » 
Author Message
KrotaZ
PostPosted: Thu May 26, 2011 3:43 pm    Post subject: broker 7 function or operator similar to java << opera Reply with quote

Novice

Joined: 30 Mar 2011
Posts: 11

Hi.

in base to this code:

public static byte[] toBytes(String cadenaBinHex) {

byte[] bytes = new byte[cadenaBinHex.length() / 2];
int charIndex = 0;

for (int i = 0; i < cadenaBinHex.length() / 2; i++) {
byte newByte = 0;
boolean convertOK = true;
String cadenaMinusculas = cadenaBinHex.toLowerCase();

for (int j = 0; j < 2; j++) {
newByte <<= 4;
char actChar = cadenaMinusculas.charAt(charIndex++);
if ((actChar >= 'a') && (actChar <= 'f')) {
newByte |= (byte) (actChar - 'a') + 10;
} else {
if ((actChar >= '0') && (actChar <= '9')) {
newByte |= (byte) (actChar - '0');
} else {
convertOK = false;
}
}
}
if (convertOK) {
bytes[i] = newByte;
}
}
return bytes;
}

is there any way to port this code to broker 7 ESQL?? the main problem we find is that it seems that broker doesn't have something like the java << operator.

If there's a way to port this java code, and in your experience will the resultant code improve the performance of the system or it'll be like calling the java function from ESQL??

Thanks guys!
Back to top
View user's profile Send private message
rekarm01
PostPosted: Thu May 26, 2011 9:59 pm    Post subject: Re: broker 7 function or operator similar to java << o Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Please use [code] tags when posting code; it's much easier to read.

KrotaZ wrote:
is there any way to port this code to broker 7 ESQL??

This should do:
Code:
bytes = CAST(cadenaBinHex AS BLOB);

Another approach is to use a combination of BLOBs, BITs, CASTs, CASE statement/function, the string operator and/or string manipulation functions to emulate bit operations, but that seems a bit messier.
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 » broker 7 function or operator similar to java << opera
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.