Author |
Message
|
deadalen |
Posted: Thu Jun 08, 2006 12:54 pm Post subject: XML VARIABLE LENGTH MESSAGES |
|
|
Newbie
Joined: 08 Jun 2006 Posts: 4
|
I’m sending message to a remote MQ on the mainframe. The messages are xml text (and as such, are variable length). I’m writing a certain number (usually 50) messages to the queue, before committing them.
The first message of each committed set seems to be processed fine. Subsequent messages that are shorter in length than the previous message contain the end of the previous message, padding it out to the max length. Here’s an example:
<A b=”123”><B c=”456”></B></A>
<A b=”1”><B c=”2”></B></A></A>
The trigger type of the remote queue is “FIRST”. I’m not a mainframe programmer, but from the little research that I’ve done, it seems that CICS begins a transaction when triggered, which lasts until the queue is empty. This implies to me that the buffer used to pass in the message from the queue is cleared when the transaction begins, but not as each message is read. Has anyone encountered this before, and if so, is there a way to fix this so that the buffer is cleared before the next message is read? |
|
Back to top |
|
 |
kevinf2349 |
Posted: Thu Jun 08, 2006 1:24 pm Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
You need to either clear the buffer or set the correct buffer length for each put.
Personally I would set the correct length of the message, but you have the choice.  |
|
Back to top |
|
 |
deadalen |
Posted: Thu Jun 08, 2006 1:59 pm Post subject: JAVA/JMS |
|
|
Newbie
Joined: 08 Jun 2006 Posts: 4
|
Thanks for your quick reply. I should add that I'm using Java/JMS to send the message. I checked the API, I don't think there is a way to specify the message length. I'm guessing that's being handled behind the scenes.
I also checked using the IBM MQ JAVA Classes directly, instead of JMS, and there also does not seem to be a way to set the message length. Probably also handled behind the scenes.
Thanks again. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jun 08, 2006 2:02 pm Post subject: Re: JAVA/JMS |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
deadalen wrote: |
Thanks for your quick reply. I should add that I'm using Java/JMS to send the message. I checked the API, I don't think there is a way to specify the message length. I'm guessing that's being handled behind the scenes.
I also checked using the IBM MQ JAVA Classes directly, instead of JMS, and there also does not seem to be a way to set the message length. Probably also handled behind the scenes.
Thanks again. |
I would expect your program to be at fault.
How are you building the message content that your are passing to the message?
Using a StringBuffer? Does it get cleared / rebuild for each message?
Enjoy the fun of hunting down errors  _________________ MQ & Broker admin |
|
Back to top |
|
 |
deadalen |
Posted: Thu Jun 08, 2006 2:19 pm Post subject: |
|
|
Newbie
Joined: 08 Jun 2006 Posts: 4
|
To attempt to prove that the program was not at fault, we switched from writing to the remote queue, to writing to a local queue, and we read the messages back from the local queue as they were being written.
The results were good. The messages were read back without any of the problems listed below. One interesting note is that we committed after each read, so maybe I should retry this test and commit every 50th record? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 08, 2006 2:32 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Maybe it is the CICS transaction that is not clearing the buffer that is being used. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kevinf2349 |
Posted: Thu Jun 08, 2006 6:31 pm Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Quote: |
This implies to me that the buffer used to pass in the message from the queue is cleared when the transaction begins, but not as each message is read. Has anyone encountered this before, and if so, is there a way to fix this so that the buffer is cleared before the next message is read? |
You are correct. MQ will not initialise (or clear) the buffer between gets....that is the application programs responsibility As Jeff says it sounds like the CICS transaction is to blame. I bet they don't check the length of the message returned and use the buffer length as this value....this is bad coding. You should always check the buffer using the actual length value, not the buffer length.
Hope this helps. |
|
Back to top |
|
 |
deadalen |
Posted: Fri Jun 09, 2006 4:20 am Post subject: |
|
|
Newbie
Joined: 08 Jun 2006 Posts: 4
|
Thanks, I’ll pass these suggestions to the programmers on the mainframe. |
|
Back to top |
|
 |
|