Author |
Message
|
murdeep |
Posted: Wed Jun 03, 2009 6:52 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
Ok, if the code that is used to build runmqdlq is the code shipped in tools\c\samples\dlq then I think I found the code that does the get:
Code: |
if( odq_Ok == rc )
/*------------------------------------------------------------------*/
/* We've got the browse cursor positioned over a message which */
/* we've got locked, and we've got a big enough buffer into which */
/* we're going to receive the message so now we go ahead and */
/* perform a destructive GET (within syncpoint). */
/* */
/*------------------------------------------------------------------*/
{
GetMsgOpts.Options = MQGMO_MSG_UNDER_CURSOR+MQGMO_CONVERT+
MQGMO_SYNCPOINT+MQGMO_PROPERTIES_IN_HANDLE ;
/**************************************************************/
/* The message which caused the truncated msg response code */
/* will not have been subject to data conversion and so the */
/* fields in the MQMD indicate the CCSID/Encoding of the */
/* message, and not those of the queue manager. */
/* Reset these fields so that we get the message in our own */
/* CCSID/Encoding. */
/**************************************************************/
MsgDesc -> Encoding = MQENC_NATIVE ;
MsgDesc -> CodedCharSetId = MQCCSI_Q_MGR ;
MQGET( odqGlobal.odqHConn,
*Hobj,
MsgDesc,
&GetMsgOpts,
*BufferLength,
*Buffer,
pMsgLength,
&CompCode,
&Reason ) ; |
So it does a get with convert.
Anyone know if there is a reason why it MUST do a get with convert? |
|
Back to top |
|
 |
exerk |
Posted: Wed Jun 03, 2009 6:57 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Hmmmmm....let me see
I know! Because it's BEST PRACTICE! _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:08 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
exerk wrote: |
Hmmmmm....let me see
I know! Because it's BEST PRACTICE! |
Never heard that GET WITH CONVERT is a best practice.
Thinking about this I can see that doing the get with convert is ok since in this case it's benign because the message as it sits on the SDLQ is in the local qmgr encoding/ccsid so no conversion would occur in any case. What is actually happening is the payload that is contained after the MQDLH is being converted . So runmqdlq must be making a call to do a second convert.
I'm going to look at the code some more. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Jun 03, 2009 7:19 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9482 Location: US: west coast, almost. Otherwise, enroute.
|
The best-practice is for the consuming application to get with convert.
This seems an odd default behavior. Ponder a hub qmgr where messages arrive from many other qmgrs with varied ccsids to be forwarded on. The qet with convert for the dlh on the hub would (needlessly) drive conversions. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 03, 2009 7:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
murdeep wrote: |
Never heard that GET WITH CONVERT is a best practice. |
The common principle here is known as "receiver makes good", i.e. whatever's reading the message does any necessary conversion. This caters for something like a pub/sub or distribution list, where receipients could be on differently code paged or encoded platforms. It also ensures a break between producer and consumer, as neither needs to know the platform of the other. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:23 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
Ok, did a test. When you do a get with convert against a message that is format MQDEAD the data following the MQDLH is also converted along with the MQDLH. So my comment that runmqdlq is doing a subsequent convert is incorrect. MQGet with convert is causing it to be converted.
I still think we should be able to control this. |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:29 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
I understand that receiver should make good when we are dealing with business applications. But in this case it seems odd to me that housekeeping function whose purpose is to forward the message from the SDLQ to a staging queue for subsequent processing would change the message. IMO, it should forward it as is. The application that then consumes the message off of the staging queue would be tasked to do the convert.
Anyone else see it this way or am I off base here? |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:35 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
Further to my comment above.
[rant]I view runmqdlq with ACTION(FWD) no different than a sending MCA that moves messages off of the xmitq. In that case we have the option of having the MCA convert or not as we should with runmqdlq.[/rant] |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Jun 03, 2009 7:42 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9482 Location: US: west coast, almost. Otherwise, enroute.
|
Please explain exactly what test you did.
Quote: |
When you do a get with convert against a message that is format MQDEAD the data following the MQDLH is also converted along with the MQDLH. |
Did you write an application to do a get with convert against a message that is format MQDEAD? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 03, 2009 7:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
murdeep wrote: |
[rant]I view runmqdlq with ACTION(FWD) no different than a sending MCA that moves messages off of the xmitq. In that case we have the option of having the MCA convert or not as we should with runmqdlq.[/rant] |
Then fix it!
The runmqdlq executable is an example, like the trigger monitor, built from the supplied sample code. If it doesn't meet your requirements, change it. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 03, 2009 7:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
murdeep wrote: |
Anyone else see it this way or am I off base here? |
IMHO off base. If you subscribe to the "receiver makes good" principle (which your site clearly doesn't or you wouldn't be in this mess) then the handler is just another application that converts the message to process it.
Your woes have their roots in the decision to process mainframe data on a Windows machine in native format. This is even worse than processing Unix data on a Windows machine in native format, as all the packed numbers are backwards in z/OS.
But in this case the discussion is pointless. The handler can be modified to be whatever a given site requires. The example supplied acts the way it does because the majority of customers use it that way, and hence use it unmodified. If you don't want to use it that way, change it and go in peace. _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Wed Jun 03, 2009 7:51 am; edited 1 time in total |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:47 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
bruce2359 wrote: |
Please explain exactly what test you did.
Quote: |
When you do a get with convert against a message that is format MQDEAD the data following the MQDLH is also converted along with the MQDLH. |
Did you write an application to do a get with convert against a message that is format MQDEAD? |
Yes, modded amqsbcg to take a flag to convert or not. |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:49 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
Vitor wrote: |
murdeep wrote: |
Anyone else see it this way or am I off base here? |
IMHO off base. If you subscribe to the "receiver makes good" principle (which your site clearly doesn't or you wouldn't be in this mess) then the handler is just another application that converts the message to process it. |
By that logic then shoulding a sending MCA always do a convert? runmqdlq with ACTION(FWD) is technically not consuming the message it is moving it to another queue. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 03, 2009 7:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
murdeep wrote: |
By that logic then shoulding a sending MCA always do a convert? runmqdlq with ACTION(FWD) is technically not consuming the message it is moving it to another queue. |
And when it's doing an ACTION(DISCARD) or and ACTION(RETRY) it's a consumer.
If you want to write a smarter, better handler based on the supplied code, then go for it as I've said.
To answer your point directly, the sending MCA doing a convert by default would require the sending machine to have all the possible conversion tables in it's OS for each possible target. The assumption is that the receiving OS will know how to translate into it's code page in more cases than the sending one will. Remember how many possible translations there are across all the platforms & languages WMQ supports. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
murdeep |
Posted: Wed Jun 03, 2009 7:57 am Post subject: |
|
|
Master
Joined: 03 Nov 2004 Posts: 211
|
Vitor wrote: |
murdeep wrote: |
Anyone else see it this way or am I off base here? |
But in this case the discussion is pointless. The handler can be modified to be whatever a given site requires. The example supplied acts the way it does because the majority of customers use it that way, and hence use it unmodified. If you don't want to use it that way, change it and go in peace. |
Agreed. |
|
Back to top |
|
 |
|