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 » Insert Message Header and content into DB

Post new topic  Reply to topic
 Insert Message Header and content into DB « View previous topic :: View next topic » 
Author Message
klabran
PostPosted: Tue Apr 20, 2004 4:36 pm    Post subject: Insert Message Header and content into DB Reply with quote

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
View user's profile Send private message Visit poster's website
kirani
PostPosted: Tue Apr 20, 2004 10:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mgk
PostPosted: Wed Apr 21, 2004 12:12 am    Post subject: Reply with quote

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
View user's profile Send private message
leongor
PostPosted: Wed Apr 21, 2004 1:52 am    Post subject: Reply with quote

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
View user's profile Send private message
klabran
PostPosted: Wed Apr 21, 2004 6:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
EddieA
PostPosted: Wed Apr 21, 2004 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 21, 2004 8:22 am    Post subject: Reply with quote

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
View user's profile Send private message
klabran
PostPosted: Thu Apr 22, 2004 7:08 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Insert Message Header and content into DB
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.