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 » IBM MQ API Support » Error when calling Get

Post new topic  Reply to topic
 Error when calling Get « View previous topic :: View next topic » 
Author Message
lifeng
PostPosted: Wed Feb 06, 2008 1:47 pm    Post subject: Error when calling Get Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

Hi,

I am calling MQGET API using the following C++.Net code.

unsigned short readmessage(short indx )
{
unsigned short retcode=0;
gmo.Version = MQGMO_VERSION_2; gmo.MatchOptions = MQMO_NONE;

gmo.Options = MQGMO_WAIT
| MQGMO_CONVERT
| MQGMO_MSG_UNDER_CURSOR // <=== (1)
| MQGMO_ACCEPT_TRUNCATED_MSG;
gmo.WaitInterval = 1000;

md.Encoding = MQENC_NATIVE;
md.CodedCharSetId = MQCCSI_Q_MGR;

short x = MQCC_UNKNOWN;
short * rtn = &x;
char * buf = MQUtility::MQGET(indx, md, gmo, rtn);
retcode = (unsigned short)(*rtn);

return(retcode);
} // <=== (2)

Here, the function MQUtility::MQGET will call the MQQueue's Get method with options, etc. When I run this, the call returns with an exception of the following message:

"MQRC_NO_MSG_UNDER_CURSOR"

If, however, I comment out the line "| MQGMO_MSG_UNDER_CURSOR" (see line lable "<=== (1)") then I can read the message out (and I can see the value when I debug it). But, after that, right before the method finishes, I will get the following error at line ("<=== (2)"):

"The runtime has encountered a fatal error. The address of the error was at 0x7a2ba518, on thread 0x808. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack."

What am I doing wrong here? What should I do to fix it?

Thanks.

Lifeng
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 06, 2008 1:54 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It makes sense that MQGMO_MSG_UNDER_CURSOR would cause your code to fail - you're not Browsing, so as the error says there is no message under the cursor.

The rest of your error is likely explained by all the odd things you are doing to assign retcode.

And remember that MQCC_OK is 0...

It's also not clear why you're trying to use a Procedural interface from an Object-Oriented language (c++) running in an Object-Oriented container (.NET).

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/csqzav05.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Error when calling Get
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.