Author |
Message
|
mbsa |
Posted: Thu Dec 12, 2013 8:40 am Post subject: MsgID Comparision with CorrID |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Hello All,
I have a requirement where I need to store the MsgID, UUID (unique id), and Message in database and retrieved the message based on this correlation id.
I have the message id as 414d512050444c4e5831314d3030303252a44dca200f667f.
The DB, the column for storing the MsgID is char.
When I try to retrieve it from DB using ESQL is it coming as X’414d512050444c4e5831314d3030303252a44dca200f667f’
If I cast it as CAST (MSGID AS CHAR CCSID 437 ENCODING 546) IT COMES AS
AMQ PDLNX11M0002RñM╩ f and it is being stored in db.
But when I am trying to compare the MsgID with CorrID and trying to get the UUID for that message and log it to different table it is failing saying duplicate UUID. That compare between MsgID with CorrID is not happening.
My question is how I compare the MsgID and CorrID using ESQL. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Dec 12, 2013 9:25 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The Datatype of the MQMD & CORRELID (and GROUPID for that matter) is BLOB.
You really need to change the datatype of the column you are storing this data in. _________________ 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 |
|
 |
mbsa |
Posted: Thu Dec 12, 2013 9:30 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Thanks for the reply.If i change it to blob how do i compare MSgID and CorrID as blobs? |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Dec 12, 2013 10:18 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The same way you compare any other two values of the same dayatype. _________________ 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 |
|
 |
Vitor |
Posted: Thu Dec 12, 2013 10:18 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mbsa wrote: |
Thanks for the reply.If i change it to blob how do i compare MSgID and CorrID as blobs? |
The same way you compare them as char. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mbsa |
Posted: Thu Dec 12, 2013 10:37 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
I changed the column datatype to varbinary(MAX).Then when i compare MsgID = CorrID.It says the = is not valid for comparing blob. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 12, 2013 10:53 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mbsa wrote: |
It says the = is not valid for comparing blob. |
No it doesn't. Not when I try it.
What version of WMB are you using? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mbsa |
Posted: Thu Dec 12, 2013 11:15 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2013 Posts: 41
|
Yes you are right Victor.Thanks. I tried with binary now,it worked.I am in WMB 8.0. |
|
Back to top |
|
 |
NealM |
Posted: Tue Dec 17, 2013 5:47 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Now that you have your problem solved mbsa, I would like to mention that you could indeed have stored your MsgID in a database varchar column and later retrieve for compare to a CorrelID.
You would use this instruction to prepare the data for insert:
Code: |
DECLARE vMSGID CHAR;
SET vMSGID = CAST(InputRoot.MQMD.MsgId AS CHARACTER); |
(Note: Do NOT include a CCSID or Encoding). This will cast the BLOB as "pseudo-hex"
And you would use this instruction to prepare the retrieved database column for compare to a correlID or reuse:
Code: |
SET OutputRoot.MQMD.MsgId = CAST(dbMSGID_CHAR AS BLOB) |
We do this also for storing and retrieving a MsgID or HTTPRequestID as an element value in an XML document.
The trick is understanding the different behavior of the CAST with/without CCSID-Encoding. |
|
Back to top |
|
 |
|