Author |
Message
|
klabran |
Posted: Tue Apr 20, 2004 4:36 pm Post subject: Insert Message Header and content into DB |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
The Header is only returning a text value = MD
???? What am I doing wrong?
I am using MQSIPUTC to put this to a queue. In MQSIPUTC I have my MQMD SETUP like...
#
# Add the MQMD
#
MQMD
STRUCID MD
VERSION 2
REPORT 0
MSGTYPE 1
EXPIRY -1
FEEDBACK 0
ENCODING 273
CODEDCHARSETID 437
FORMAT MQSTR
PRIORITY 0
PERSISTENCE 1
BACKOUTCOUNT 0
REPLYTOQ MQREPLY
REPLYTOQMGR MYQM
USERIDENTIFIER userid
PUTAPPLTYPE B
The message itself is XML and I am using the XML parser in MQSI.
MQSI Code in a compute node...
SET OutputRoot = InputRoot;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE INMSG CHAR;
DECLARE HEADER CHAR;
SET INMSG = cast(asbitstream(OutputRoot.XML,,437) as CHAR CCSID 437);
SET HEADER = cast(asbitstream(OutputRoot.MQMD,,437) as CHAR CCSID 437);
PASSTHRU('insert into tblCAFilingInAudit (sMsgHeader,sdata) values(?,?)',HEADER,INMSG); |
|
Back to top |
|
 |
kirani |
Posted: Tue Apr 20, 2004 10:25 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
which DB are you using? Have you tried using INSERT statement instead of PASSTHRU. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
mgk |
Posted: Wed Apr 21, 2004 12:12 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Try to use BLOBs as it looks like your data looks like it is being truncated on NULLS in the message structure
Cheers _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
leongor |
Posted: Wed Apr 21, 2004 1:52 am Post subject: |
|
|
 Master
Joined: 13 May 2002 Posts: 264 Location: Israel
|
Try Warehouse node. It supposed to do the job. _________________ Regards.
Leonid.
IBM Certified MQSeries Specialist. |
|
Back to top |
|
 |
klabran |
Posted: Wed Apr 21, 2004 6:15 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
I can't use the Warehouse node because I am using an xml message without defining a message/message set for it.
As for BLOB's .... A little code snippet to help me... ? Although I want to store the message textually not binary if possible.
DECLARE HEADER CHAR;
DECLARE HBLOB BLOB;
SET HBLOB = cast(asbitstream(OutputRoot.MQMD) as BLOB);
SET HEADER = cast(HBLOB as CHAR CCSID 437);
Produces the same results...
And I am using SQL 7 at the moment and I used passthru because the reading that I have done stated it is faster than Insert. I have not tried insert and would hope that it doesn't react differently? |
|
Back to top |
|
 |
EddieA |
Posted: Wed Apr 21, 2004 8:16 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
The problem with the MQMD is that it contains binary values, so when you treat this BLOB as TEXT, the nulls, that are actually part of the integer version cause an "end of data".
You either need to store the header as "expanded" hex, or build a multi-column table, where you store only the values you need to keep.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 21, 2004 8:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
klabran wrote: |
DECLARE HEADER CHAR;
DECLARE HBLOB BLOB;
SET HBLOB = cast(asbitstream(OutputRoot.MQMD) as BLOB);
SET HEADER = cast(HBLOB as CHAR CCSID 437);
Produces the same results... |
It produces the same results, because you are doing the same thing. CASTing a binary set of data to a CHARacter string.
Which only works "properly" as long as the bits in the binary data are valid bits for character fields. And NULL (binary 00 in most CCSIDs) is the string terminator in most character data type definitions.
What is the data type of the column in your SQLServer table that you are putting this into? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klabran |
Posted: Thu Apr 22, 2004 7:08 am Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
Ah....
OK, so binary it is for storage then.
Thanks for the explanations everyone. |
|
Back to top |
|
 |
|