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 » Converting an integer to a corresponding hexadecimal string.

Post new topic  Reply to topic
 Converting an integer to a corresponding hexadecimal string. « View previous topic :: View next topic » 
Author Message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 4:22 pm    Post subject: Converting an integer to a corresponding hexadecimal string. Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

Hi, I need to construct a correlation id from an application specific value(e.g policy number). for this i need to construct a hexadecimal string.please help.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun Nov 01, 2009 5:41 pm    Post subject: Re: Converting an integer to a corresponding hexadecimal str Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kuladeep.dairy wrote:
Hi, I need to construct a correlation id from an application specific value(e.g policy number).


It's very seldom a good idea to use a non-WMQ generated id value. Be sure you've reviewed the discussions on this forum on this subject so you're aware of the restrictions, shortcomings and pitfalls of this method.

Having said that, are you trying to do this in Java, ESQL or what?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 8:21 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

Hi Vitor, Thanks your the response.
I might have to do that...
And,I was trying to it in ESQL. Can you please suggest a way to do this.I went thru the documentation. But I coudnt find any functions/ways to do it/
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 01, 2009 9:46 pm    Post subject: Reply with quote

Grand High Poobah

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

kuladeep.dairy wrote:
Hi Vitor, Thanks your the response.
I might have to do that...
And,I was trying to it in ESQL. Can you please suggest a way to do this.I went thru the documentation. But I coudnt find any functions/ways to do it/

Well in ESQL the correlId is not a hex string but a BLOB. You may not appreciate the subtle difference but it is there. You can append hex 00 to the end of your BLOB to get up to 24 bytes.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 10:10 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

Thanks Pooba. I was thinking of converting a policy number, say 12345678 to hexa decimal string and append '00' to make it to the length of a correlid.

I was wonding if there is a function or a way to convert this 12345678 to the corresponding hex string.
or do we have to write our own function?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 01, 2009 10:47 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

kuladeep.dairy wrote:
Thanks Pooba. I was thinking of converting a policy number, say 12345678 to hexa decimal string and append '00' to make it to the length of a correlid.

I was wonding if there is a function or a way to convert this 12345678 to the corresponding hex string.
or do we have to write our own function?


To restate what has been said by fjb, the MsgId & CorrelId in an MQ MQMD are BLOB fields not hex strings.

There are many posts in this forum about using the MsgId & CorrelId field for various things. There are also posts about converting character stribgs to Blob's.

Please tell us what you have tried for yourself. This way we can avoid suggesting things you have already tried.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 11:10 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

Hi,Thank you. messageId&correlId are BLOB's;i got that point.

i had tried the below code. and it is constructing a blob that works as a correlId.

DECLARE corelID CHAR Environment.Variables.Policy||LossfDate;
SET OutputRoot.MQMD.CorrelId =CAST(corelID||corelID||corelID AS BLOB)

(* the length of this char variable, CorrelId is 16 chars. to get 48 characters it is appended twice to itself)

But by looking at a typical msgid/correlId(e.g. 414d51204346514d20202020202020203e7ce74a20079d05) I thought that msgid/correlid consists of a hexa decimal string.So i was trying to convert my char string to a hex string.
I wanted to know if there is any way to do it in ESQL. (May be we have to write our own function for going thru all chars in the string and convetin them to the corresponding hex digits.)
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 01, 2009 11:26 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

BLOB's are typically shown (especially in tools like rfhutil) as a string of HEX Characters simply because there is no way to parse them because they are BLOB's.

Ok, you have made a start.
One suggestion would be to create a string of characters full of '0'. Then OVERLAY on top of that the data you want in your string and then convert that to a BLOB. That should get rid of the padding.

It also helps if you put code (aka ESQL) in CODE tags.

Finally, NO, you don't have to write a special function to do this.

/Stephen D
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 11:27 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

hmm..okay
414d51204346514d20202020202020203e7ce74a20079d05 in this 41 represents just a byte!! ....
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 11:30 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

sorry.My bad.I got what i wanted. Thanks for the help.
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Sun Nov 01, 2009 11:34 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

smdavies99,
Thank you for your suggestion!
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 01, 2009 11:52 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Please let us know your solution so that others can benefit as well
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kuladeep.dairy
PostPosted: Mon Nov 02, 2009 12:46 am    Post subject: BLOB's are typically shown (especially in tools like rfhutil Reply with quote

Apprentice

Joined: 11 Jul 2009
Posts: 38

Davis,
while you were composing that last but one post, i sent those 2 msgs, i am going to implement your suggestion. Thanks a lot for your help
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 » Converting an integer to a corresponding hexadecimal 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.