Author |
Message
|
asutoshch |
Posted: Wed Jul 14, 2004 4:54 am Post subject: MQGET Error |
|
|
Newbie
Joined: 14 Jul 2004 Posts: 3 Location: India
|
Hi, I am developing a small piece of code in C to retrieve messages from an MQ Queue. I did MQCONN, MQOPEN successfully and then on MQGET, it returns failure with reason code = 2079 when I mention MQGMO_ACCEPT_TRUNCATED_MSG in gmo.Options. Otherwise it returns 2080. In any case, it does not solve my purpose. I want to retrieve all messages successfully. The buffer size is made enough (1MB) to hold the message. Also I can see the message length retrieved is below 1000. The retrieved message, when I use printf, shows only first 3 characters.
Someone told me to use useEmptyBuffer(). But again I could not follow why to use that and also it is available when using C++ only (Not C).
Can someone help me in resolving this issue ? I am not able follow.
Thanks
AC |
|
Back to top |
|
 |
JasonE |
Posted: Wed Jul 14, 2004 5:22 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
What are you putting in the 5th parm to MQGET - That specifies the size of the buffer provided. The size used is returned from the 7th parm to MQGET. |
|
Back to top |
|
 |
asutoshch |
Posted: Wed Jul 14, 2004 5:32 am Post subject: |
|
|
Newbie
Joined: 14 Jul 2004 Posts: 3 Location: India
|
The 5th parameter is the bufferlength=1000000 and the 7th parameter returns the size of actual message retrieved. It shows some value below 1000. I am using the value of 5th parameter to allocate memory for the 6th parameter buffer to hold the message. I guess the the 5th parameter can be more than the actual size of the messages. |
|
Back to top |
|
 |
JasonE |
Posted: Wed Jul 14, 2004 5:46 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
That sounds ok. If you amqsbcg the queue file, and look at message 1, what is its data length?
Try taking a trace, formatting it (if non-windows), finding the trace file for the C application (look at the header, its obvious...) and find the two sections:
MQGET >> is entry to MQGET
MQGET << is exit from MQGET
What does it say the parms are? |
|
Back to top |
|
 |
gunter |
Posted: Wed Jul 14, 2004 6:21 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
What os are you using? Maybe I can help if you post the code and a short description of the message. _________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
asutoshch |
Posted: Wed Jul 14, 2004 9:05 pm Post subject: |
|
|
Newbie
Joined: 14 Jul 2004 Posts: 3 Location: India
|
I could not follow it properly. Do you want me to store the read buffer into a file and then check the contents? Thanks for your help.
Asutosh |
|
Back to top |
|
 |
JasonE |
Posted: Thu Jul 15, 2004 1:07 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I've sent you a PM. Also, what platform, release and fixpack/csd are you using? |
|
Back to top |
|
 |
silentflute |
Posted: Thu Jul 15, 2004 4:05 am Post subject: MQGET Error |
|
|
 Apprentice
Joined: 14 Jul 2004 Posts: 32
|
You could use the WMQ sampe program 'amqsget' as a sample to model your C program after.
HTH |
|
Back to top |
|
 |
|