Author |
Message
|
meenakshi |
Posted: Mon Jul 25, 2005 2:57 am Post subject: Problem with the MQMD field |
|
|
 Novice
Joined: 15 Jun 2005 Posts: 11 Location: India
|
Hi,
I have built a custom application to put messages on a queue. I am using MQMD set to MQMD_DEFAULT. The application is built with "mqm" to produce a server executable and "mqic" to produce a client executable.
I noticed that the "PutApplName" filed of MQMD is being populated by both the executables in a different manner.
For the server executable the "PutApplName" is blank padded like all other string fields. However in the client executable the "PutApplName" is null terminated. Also i noticed that this is the only field that is null terminated for the client executable.
This is giving me problems later when i try to compare the two messages as the MQMD fields are then different.
Could anyone tell me how to solve this problem. |
|
Back to top |
|
 |
malammik |
Posted: Mon Jul 25, 2005 4:59 am Post subject: |
|
|
 Partisan
Joined: 27 Jan 2005 Posts: 397 Location: Philadelphia, PA
|
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 25, 2005 5:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
malammik wrote: |
trim it before reading. |
I think you mean "comparing", not reading. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
meenakshi |
Posted: Mon Jul 25, 2005 5:32 am Post subject: |
|
|
 Novice
Joined: 15 Jun 2005 Posts: 11 Location: India
|
Yes,
I am trying two compare the messages on the two queues. The compare fails as the MQMD is not matching because the PutApplName for one of them is null terminated and the other is blank padded. I am using memcmp to compare the MQMDs.
You would suggest to handle the discrepancy while comparing the messages. I was thinking of a way to blank pad the PutApplName for the client application as well.
Intresting thing is that if we set the PutApplName field of the MQMD which is null terminated explicitly and use MQPMO_SET_ALL_CONTEXT and put the message, WMQ queue manager blank pads the PutApplName field. This is a problem only when i try using MQMD_DEFAULT. In this case the PutApplName field is an output only field and is populated by WMQ queue manager. The only drawback here would be that the client would need setall permission queue. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 25, 2005 6:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You basically have three choices.
1) File a PMR with IBM, and wait for them to fix what they will probably perceive as an extremely low priority problem.
2) Change your code to work around a very minor bug by using set all context, and requiring a more complicated permissions setup.
3) Write your code to be more robust in what it accepts, by doing things like trimming data to ensure consistancy.
I know what I'd do - #3 is always a good move in my book. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
meenakshi |
Posted: Mon Jul 25, 2005 6:16 am Post subject: |
|
|
 Novice
Joined: 15 Jun 2005 Posts: 11 Location: India
|
Thanks a lot,
I guess i will go with option 3 itself. Indeed the easier way out, is to do an intelligent compare. I was just checking if there was any other possible solution.
Thanks for your answers. |
|
Back to top |
|
 |
|