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 » Mainframe, CICS, TXSeries » Get Message - skipping Message Header

Post new topic  Reply to topic Goto page 1, 2  Next
 Get Message - skipping Message Header « View previous topic :: View next topic » 
Author Message
nascar8mdj
PostPosted: Thu Feb 08, 2007 9:44 am    Post subject: Get Message - skipping Message Header Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Is there a way to only retrieve the Message portion of the data without getting the Message Header? In my scenario, this particular Queue will only be used for one reason so all I really need to get is the Message. If not, is there a guarantee that the Message Header will always be the same length?
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Feb 08, 2007 10:51 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

What language are using calling the MQI in?
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Feb 08, 2007 10:54 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

What message header. The MQMD and message payload are presented in different parameters/structures.

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
nascar8mdj
PostPosted: Thu Feb 08, 2007 1:01 pm    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

zpat wrote:
What language are using calling the MQI in?


COBOL
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 1:22 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/csqzak10309.htm

None of these parameters are optional.

You can safely ignore whatever is populated in them, depending on your functional requirements.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
nascar8mdj
PostPosted: Thu Feb 08, 2007 1:30 pm    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

jefflowrey wrote:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/csqzak10309.htm

None of these parameters are optional.

You can safely ignore whatever is populated in them, depending on your functional requirements.


I have all these parameters defined when doing the GET. What I get back in the BUFFER is what I call the Message Header (Message Descriptor?) AND the Message Data. All I want in this area is the Message Data. I have 2 different Queues that I read from for 2 different processes and it appears that the Message Header is a different length for each process.

This is my first MQ experience so maybe I just don't understand what I'm getting back and how to handle it.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 08, 2007 1:44 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay.

What you'll get back in the Message Descriptor is the MQMD header.

The format field on that MQMD header will indicate if there are *additional* headers in the message. IF there are additional headers in the message, then they will be in the Message Body.

So that's probably what you're seeing - additional headers.

If you are getting messages from a Java program that is using JMS - the simplest solution is to ask them to set the TargetClient on their configuration to MQ, rather than JMS.

If you're not getting messages from a JMS application, then you'll have to look at the MQMD Format field and determine what kind of header it is. That will help you determine what you can do to skip or ignore it.

Or you can try and code COBOL to skip everything in the Message Body until you reach a blank line/record.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
nascar8mdj
PostPosted: Thu Feb 08, 2007 2:04 pm    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Thanks! That information helps alot. You are correct, I am receiving data from a JAVA application.
Back to top
View user's profile Send private message
nascar8mdj
PostPosted: Mon Feb 12, 2007 7:02 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Next question...

The change was made to set the TargetClient to MQ but there's still header information coming across. Is there something on the JMS side regarding the message format that could be changed? When I put data to this Queue using another COBOL program and then get the data, I don't get this header information which makes me think there should be another change on the sending side.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Feb 12, 2007 7:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What does the header information look like?

Does it contain "MQHRF2"?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
nascar8mdj
PostPosted: Mon Feb 12, 2007 7:14 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2007
Posts: 6

Character:
MDE 4MQSTR

Hex:
DCC4000000040001000FDDEED4440000333323323300000000000000000000000000FFFF
445000020008003100144823900000002007D09D0400000000000000000100000008FFFF
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Feb 12, 2007 7:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah!

That's an MQMD Extension header.
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/mqmde.htm

There's notes somewhere in the APG or the APR about dealing with that header.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nigelg
PostPosted: Mon Feb 12, 2007 8:29 am    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

The most likely reason for getting an MDE as msg data rather than subsumed into the MD is that the MQGET is being done with an MD version 1 instead of an MD version 2.

Add this line
Code:

md.Version = MQMD_VERSION_2;


to the getting application in C; you will need the equivalent if the app is not in C.
_________________
MQSeries.net helps those who help themselves..
Back to top
View user's profile Send private message
jsware
PostPosted: Tue Feb 13, 2007 12:50 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

In C the following code will skip the headers:

Code:

    MQMD mqmd;
    MQBYTE buffer[8192];
    MQLONG dataLen;
    int bufferPos = 0;
   
    /* Do your MQGET here */

    MQCHAR *currFmt = mqmd.Format;

    while(bufferPos < dataLen) {
        if(strncmp(currFmt, MQFMT_RF_HEADER, MQ_FORMAT_LENGTH) == 0) {
            /* We got an RFH header so skip it. */
            MQRFH *rfh = (MQRFH *)(buffer + bufferPos);
            currFmt = rfh->Format;
            bufferPos += rfh->StrucLength;
        } else if(strncmp(currFmt, MQFMT_RF_HEADER_2, MQ_FORMAT_LENGTH) == 0) {
            /* We got an RFH2 header so skip it. */
            MQRFH2 *rfh2 = (MQRFH2 *)(buffer + bufferPos);
            currFmt = rfh2->Format;
            bufferPos += rfh2->StrucLength;
        } else if(strncmp(currFmt, MQFMT_DEAD_LETTER_HEADER, MQ_FORMAT_LENGTH) == 0) {
            /* We've got a Dead letter header so skip it. */
            MQDLH *pDLH = (MQDLH *)(buffer + bufferPos);
            currFmt = pDLH->Format;
            bufferPos += sizeof(MQDLH);
        } else {
            /* Break out of the skip loop as we've come across an unknown format type. */
            break;
        }
    }


At the end, bufferPos is the index to the start of your payload (or unrecognised header). Adapt it to your own language/needs
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
christian witschel
PostPosted: Wed Mar 26, 2008 4:19 am    Post subject: Reply with quote

Apprentice

Joined: 07 Dec 2005
Posts: 27

can someone hint me how to correctly skip rfh and rfh2 headers in java?

The C example above is already very helpfull. However, I do not understand how you know how much bytes to skip until the next header starts.
What is bufferPos += rfh->StrucLength; doing. What is StrucLength?
As far as I know the RFH2 header is not fixed in size as it can contain addtional custom values.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » Get Message - skipping Message Header
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.