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 » General Discussion » convert hexa to string

Post new topic  Reply to topic
 convert hexa to string « View previous topic :: View next topic » 
Author Message
earrieta
PostPosted: Mon Nov 03, 2008 2:29 pm    Post subject: convert hexa to string Reply with quote

Newbie

Joined: 20 Jun 2008
Posts: 9

message id and correlid en format hexa, convert to string
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Mon Nov 03, 2008 3:18 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9403
Location: US: west coast, almost. Otherwise, enroute.

MSGID and CORRELID are not character fields; rather, they are MQBYTE24 fields, which means that they are just 24 bytes of bits, and do not have a character representation.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 03, 2008 3:35 pm    Post subject: Re: convert hexa to string Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

earrieta wrote:
message id and correlid en format hexa, convert to string

There are numerous programs on google showing how to represent the value of a byte as a hex string from 00 to FF.

You cannot convert the byte array to a string you can only represent it in a string form (00-FF)

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
atheek
PostPosted: Mon Nov 03, 2008 4:39 pm    Post subject: Reply with quote

Partisan

Joined: 01 Jun 2006
Posts: 327
Location: Sydney

If looking at Java, this may help:

http://www.mqseries.net/phpBB2/viewtopic.php?t=45722
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Nov 04, 2008 5:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

The amqsbcg sample program dumps the message id and correlation id out. You might want to look at it as well.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
gs
PostPosted: Tue Nov 11, 2008 1:02 am    Post subject: Reply with quote

Master

Joined: 31 May 2007
Posts: 254
Location: Sweden

The example in the linked thread was kind of messy so here's an easier way to do it (where b[] is your byte array of any size):

Code:
String msgId = "";
for (int i = 0; i < b.length; i++) {
  msgId += Integer.toHexString((b[i] & 0xff) + 0x100).substring(1);
}


The 0x100 add & substring is to deal with leading zeroes which toHexString strips.
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 » General Discussion » convert hexa to string
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.