|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQGET error 2110 |
« View previous topic :: View next topic » |
Author |
Message
|
nan |
Posted: Wed Jul 30, 2008 1:40 am Post subject: MQGET error 2110 |
|
|
Newbie
Joined: 30 Jul 2008 Posts: 3
|
Hi,
Please find the below code to connect to a queue, open it and get the data. The code is able to connect and open the queue. But when trying to get the data, bus error is thrown. Please let me know where I have gone wrong.
#include <stdio.h>
#include <stdlib.h>
#include <cmqc.h>
#define NO_COMMITS 'N'
#define YES_COMMITS 'Y'
#define CONN_CONNECTED 'C'
#define CONN_DISCONNECTED 'D'
#define QUEUE_OPEN 'O'
#define QUEUE_CLOSED 'C'
#define FILE_REC_LEN 1024
/* Declare MQI structures needed */
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQGMO gmo = {MQGMO_DEFAULT}; /* GET message options */
MQHCONN Hcon; /* connection handle */
MQHOBJ Hobj; /* object handle */
MQLONG O_options; /* MQOPEN options */
MQLONG C_options; /* MQCLOSE options */
MQLONG CompCode; /* completion code */
MQLONG OpenCode; /* MQOPEN completion code */
MQLONG Reason; /* reason code */
MQLONG CReason; /* reason code for MQCONN */
MQLONG buflen; /* buffer length */
MQLONG messlen; /* message length */
unsigned char buffer[20000]; /* message buffer */
FILE *fp;
char command[100];
char filename[100];
char CommitSw = NO_COMMITS;
char PassLQMgr[200];
char PassTriggerQueue[100];
char ConnStatus = CONN_DISCONNECTED;
char QueueStatus = QUEUE_CLOSED;
void main()
{
strcpy(PassLQMgr,"LQMGR");
strcpy(PassTriggerQueue, "QL.TRIGGER.QUEUE");
/*strcpy(PassTriggerQueue, "QL.APP.ONLINE");*/
/******************************************************************/
/* Connect to queue manager */
/******************************************************************/
if (ConnStatus == CONN_DISCONNECTED)
{
printf("Connect to MQ Queue Manager %s\n", PassLQMgr);
MQCONN(PassLQMgr, /* queue manager */
&Hcon, /* connection handle */
&CompCode, /* completion code */
&CReason); /* reason code */
}
printf("reason code %ld\n", CReason);
printf("completion code %ld\n", CompCode);
if (CompCode == MQCC_FAILED)
{
printf("FATAL ERROR: ");
printf("MQCONN FAILED - connect with Queue Manager - reason code %ld\n", CReason);
}
else
printf("Connection Success\n");
strncpy(od.ObjectQMgrName, PassLQMgr, (size_t)MQ_Q_NAME_LENGTH);
strncpy(od.ObjectName, PassTriggerQueue, (size_t)MQ_Q_NAME_LENGTH);
if (QueueStatus == QUEUE_CLOSED)
{
O_options = MQOO_INPUT_AS_Q_DEF /* open queue for input */
+ MQOO_FAIL_IF_QUIESCING; /* but not if MQM stopping */
MQOPEN(Hcon, /* connection handle */
&od, /* object descriptor for queue */
O_options, /* open options */
&Hobj, /* object handle */
&OpenCode, /* MQOPEN completion code */
&Reason); /* reason code */
printf("MQ open reason code %ld\n", Reason);
printf("MQ Open code %ld\n", OpenCode);
/* report reason, if any; stop if failed */
if (Reason != MQRC_NONE)
{
printf("FATAL ERROR: ");
printf("MQOPEN FAILED - WMS Trigger Queue - reason code %ld\n", Reason);
}
if (OpenCode == MQCC_FAILED)
{
printf("FATAL ERROR: ");
printf("Unable to open queue for input\n");
}
/* End program if error was encountered */
if((Reason != MQRC_NONE) ||
(OpenCode == MQCC_FAILED))
if (Reason == MQRC_NONE &&
OpenCode != MQCC_FAILED)
QueueStatus = QUEUE_OPEN;
}
/****************************************************************/
/* GET a message from the WMS "trigger" queue. */
/****************************************************************/
memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId));
memcpy(md.CorrelId, MQCI_NONE, sizeof(md.CorrelId));
buflen = sizeof(buffer) - 1;
if( CommitSw == YES_COMMITS )
{
gmo.Options = MQGMO_WAIT
+ MQGMO_CONVERT;
+ MQGMO_SYNCPOINT;
}
else
{
gmo.Options = MQGMO_WAIT
+ MQGMO_CONVERT;
}
gmo.WaitInterval = 03000;
MQGET(Hcon,
Hobj,
&md,
&gmo,
buflen,
buffer,
&messlen,
&CompCode,
&Reason);
printf("MQ GET reason code %ld\n", Reason);
printf("MQ GET completion code %ld\n", CompCode);
printf("msg id and corr id are %ld %ld\n", *md.MsgId,*md.CorrelId);
printf("Buffer is %s\n", buffer);
printf("bufflen %d\n", buflen);
printf("messlen %d\n", messlen);
}
Thanks,
nan |
|
Back to top |
|
 |
Mr Butcher |
Posted: Wed Jul 30, 2008 2:09 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
2110 X'083E' MQRC_FORMAT_ERROR
An MQGET call was issued with the MQGMO_CONVERT option specified in the
GetMsgOpts parameter, but the message cannot be converted successfully
due to an error associated with the message format. Possible errors
include:
o The format name in the message is MQFMT_NONE.
o A user-written exit with the name specified by the Format field in the
message cannot be found.
o The message contains data that is not consistent with the format
definition.
..... _________________ Regards, Butcher |
|
Back to top |
|
 |
zpat |
Posted: Wed Jul 30, 2008 3:48 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
In terms of how to handle this error, you can
Choose to ignore it and get the next message (throwing the invalid message away).
Put the invalid message onto another queue and get the next message.
Get it again without convert and see if the CCSID id is what you expected.
Essentially this is a message format error (should be MQSTR), not a code error. |
|
Back to top |
|
 |
nan |
Posted: Wed Jul 30, 2008 5:06 am Post subject: |
|
|
Newbie
Joined: 30 Jul 2008 Posts: 3
|
Thanks for all your responses. There was some format error due to which I got the error. Thanks for all your time.  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|