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 » why AMQ 1/4 instead MsgId ?

Post new topic  Reply to topic
 why AMQ 1/4 instead MsgId ? « View previous topic :: View next topic » 
Author Message
nheng
PostPosted: Wed Sep 30, 2009 9:04 pm    Post subject: why AMQ 1/4 instead MsgId ? Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

CREATE PROCEDURE InsertSOALOG(IN MSGIDVal CHARACTER ,
IN SVRCODEVal CHARACTER ,
IN UIDVal CHARACTER,
IN PRODUCTCODEVal CHARACTER ,
IN DIRECTIONVal CHARACTER
)
BEGIN
DECLARE strESQL CHARACTER '';
DECLARE strVal CHARACTER '';
DECLARE strFld CHARACTER '';

SET strFld = strFld || ' UID ';
SET strVal = strVal || '''' || ValidateMand(UIDVal) || '''';
SET strFld = AddCommaAtLast(strFld);
SET strFld = strFld || ' SVRCODE ';
SET strVal = AddCommaAtLast(strVal);
SET strVal = strVal || '''' || ValidateMand(SVRCODEVal) || '''';
SET strFld = AddCommaAtLast(strFld);
SET strFld = strFld || ' PRODUCTCODE ';
SET strVal = AddCommaAtLast(strVal);
SET strVal = strVal || '''' || ValidateMand(PRODUCTCODEVal) || '''';
SET strFld = AddCommaAtLast(strFld);
SET strFld = strFld || ' DIRECTION ';
SET strVal = AddCommaAtLast(strVal);
SET strVal = strVal || '''' || ValidateMand(DIRECTIONVal) || '''';
SET strFld = AddCommaAtLast(strFld);
SET strFld = strFld || ' RQMSGID ';
SET strVal = AddCommaAtLast(strVal);
SET strVal = strVal || ValidateMand(MSGIDVal) ;

SET strESQL = strESQL || 'INSERT INTO Database.EAIMBDB.DB2INST1.SOATXNLOG( ';
SET strESQL = strESQL || strFld;
SET strESQL = strESQL || ' ) VALUES( ';
SET strESQL = strESQL || strVal;
SET strESQL = strESQL || ' );';

EVAL(strESQL);
--PASSTHRU strESQL TO Database.EAIMBDB ;
END;

Follow code as upper.this procedure be called as below.

DECLARE MsgIdval CHARACTER InputRoot.MQMD.MsgId;
CALL InsertSOALOG(MsgIdval ,..........);


QM name:EAIMBP.QM

First question.
Msgid field in database has value "AMQ EAIMBP.QM 1/4..." .
It should be X'21657498795249879849....'.Why do it not work?

Second question.
My code should be PASSTHRU replace EVAL or not ?


Last edited by nheng on Wed Sep 30, 2009 11:03 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
rekarm01
PostPosted: Wed Sep 30, 2009 9:57 pm    Post subject: Re: why AMQ 1/4 instead MsgId ? Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Please put code between [code]...[/code] tags, to preserve the indenting; it's easier to read that way.

nheng wrote:
First question.
Msgid field in database has value "AMQ EAIMBP.QM 1/4..." .
It should be X'21657498795249879849....'.Why do it not work?

What does ValidateMand() do?

nheng wrote:
Second question.
My code should be PASSTHRU replace EVAL or not?

Yes.
Back to top
View user's profile Send private message
nheng
PostPosted: Wed Sep 30, 2009 10:13 pm    Post subject: as Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

ValidateMand() = If it is blank or null or '' it wil throw exception.if it has value will return original value.
Back to top
View user's profile Send private message MSN Messenger
nheng
PostPosted: Thu Oct 01, 2009 12:59 am    Post subject: as Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

Nobody can't solve this..
Back to top
View user's profile Send private message MSN Messenger
Luke
PostPosted: Thu Oct 01, 2009 1:07 am    Post subject: Re: as Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

nheng wrote:
First question.
Msgid field in database has value "AMQ EAIMBP.QM 1/4..." .
It should be X'21657498795249879849....'.Why do it not work?


Looks like somewhere you are CASTing the MsgId to CHAR and specifying a CCSID ... I'd guess you want to CAST without CCSID to get a character representation of the field .... this has been discussed several times before on this forum.
Back to top
View user's profile Send private message
nheng
PostPosted: Thu Oct 01, 2009 1:16 am    Post subject: Re: as Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

Luke wrote:
nheng wrote:
First question.
Msgid field in database has value "AMQ EAIMBP.QM 1/4..." .
It should be X'21657498795249879849....'.Why do it not work?


Looks like somewhere you are CASTing the MsgId to CHAR and specifying a CCSID ... I'd guess you want to CAST without CCSID to get a character representation of the field .... this has been discussed several times before on this forum.

Thank for reply.


DECLARE MSGVal CHARACTER CAST(InputRoot.MQMD.MsgId AS CHARACTER CCSID 1208);
or
DECLARE MSGVal CHARACTER CAST(InputRoot.MQMD.MsgId AS CHARACTER CSSID InputRoot.MQMD.CodedCharSetId);
or
DECLARE MSGVal CHARACTER 'XXXXXX';

All not work.I alway find everything in this forum before post somthing.


CREATE COMPUTE MODULE Insert_Compute
BEGIN
DECLARE MSGVal CHARACTER CAST(InputRoot.MQMD.MsgId AS CHARACTER CCSID 1208);
CALL InsertSOALOG(IN MSGIDVal CHARACTER , ....);
)
END MODULE;

CREATE PROCEDURE InsertSOALOG(IN MSGIDVal CHARACTER , ......)
BEGIN
END;
Back to top
View user's profile Send private message MSN Messenger
smdavies99
PostPosted: Thu Oct 01, 2009 1:44 am    Post subject: Reply with quote

Jedi Council

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

Quote:

First question.
Msgid field in database has value "AMQ EAIMBP.QM 1/4..." .
It should be X'21657498795249879849....'.Why do it not work?


The MsgId field in the MQMD is a BINARY field. The 'AMQ EAIMBP...' you are seeing is a TEXT representation of that field. It looks like the MQMD.MsgID field was left blank when the original message was sent and WMQ did its normal thing and fills one in for you.

If you are expecting a specific HEX string then it looks like the sender has not setup the message and the various options before the message was sent.
You can mess around/experiment/test with the various fields in the MQMD using the rfhutil application and send the message into your broker with the changes.
_________________
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
Luke
PostPosted: Thu Oct 01, 2009 1:55 am    Post subject: Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

If you want a caharacter representation that looks like this:

X'21657498795249879849....'

Then code:

Code:
DECLARE MSGVal CHARACTER CAST(InputRoot.MQMD.MsgId AS CHARACTER);


If you specify CCSID, it will try and interpret the binary as a representation of the specified codepage, and you'll get results like:

'AMQ EAIMBP.QM 1/4.. '

Hope that helps ...
Back to top
View user's profile Send private message
nheng
PostPosted: Thu Oct 01, 2009 2:34 am    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

Luke wrote:
If you want a caharacter representation that looks like this:

X'21657498795249879849....'

Then code:

Code:
DECLARE MSGVal CHARACTER CAST(InputRoot.MQMD.MsgId AS CHARACTER);


If you specify CCSID, it will try and interpret the binary as a representation of the specified codepage, and you'll get results like:

'AMQ EAIMBP.QM 1/4.. '

Hope that helps ...

Thank a lot
But it doesn't work
Has exception as below:

[IBM][CLI Driver][DB2/AIX64] SQL0103N The numeric literal "414d51204541494d4250352e514d20204abc416e20026804" is not valid. SQLSTATE=42604 ' (CHARACTER)
Back to top
View user's profile Send private message MSN Messenger
smdavies99
PostPosted: Thu Oct 01, 2009 3:02 am    Post subject: Reply with quote

Jedi Council

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

Three points.

1) The MQMD.MsgId field is 20 bytes long. Your sample string is longer than that.
2) What is the data tyoe & size of the DB field where you are trying to do the DB operation.
3) Have you looked up what the SQLState value 42604 actually means? A simple google for "DB2 SQLSTATE 42604" brings a plethora of answers.
_________________
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
Luke
PostPosted: Thu Oct 01, 2009 4:32 am    Post subject: Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

smdavies99 wrote:

1) The MQMD.MsgId field is 20 bytes long. Your sample string is longer than that.

Isn't it 24 bytes? I think it's 24 bytes as a BLOB, but when CAST to a character represntation, it should be 48 bytes (without the X' and ' at start and end).

Point 2 is very relevant I think though ...

nheng, it is not a number!
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Oct 01, 2009 5:00 am    Post subject: Reply with quote

Jedi Council

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

Luke,
Sorry, my mistake. It is indeed 24 bytes for the MsgId field (and CorrelID)

Your last point
Quote:

nheng, it is not a number!


Is also very relevant. As I said before it is a binary field.
_________________
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
nheng
PostPosted: Thu Oct 01, 2009 7:06 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2007
Posts: 39

smdavies99 wrote:
Luke,
Sorry, my mistake. It is indeed 24 bytes for the MsgId field (and CorrelID)

Your last point
Quote:

nheng, it is not a number!


Is also very relevant. As I said before it is a binary field.


Thank u very much for reply.This problem has beed solved

DECLARE MSGIDVal CHARACTER SUBSTRING(InputRoot.MQMD.MsgId FROM 3 FOR 48 ) ;

and add single quote in

SET strVal = strVal || '''' || ValidateMand(MSGIDVal) || '''' ;


Result in DB:414d51204541494d4250352e514d20204abc416e20022702
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » why AMQ 1/4 instead MsgId ?
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.