Hi, Your code looks fine, except you are doing a programming no-no. I don't like the following line: memcpy(md.CorrelId, "COR1", sizeof(md.CorrelId));
The string "COR1" is only 4 bytes (memcpy does not copy the NULL) but you are copying 24 bytes (because sizeof(md.CorrelId) is 24). Therefore, you are copying 20 bytes of garbage. You should setup a define to hold the string plus ALL blank padding. i.e. #define COR1 "COR1 " // COR1 with 20 blanks Then your memcpy would look like: memcpy(md.CorrelId, COR1, sizeof(md.CorrelId)); By the way, just to clean up your code, change the following: memcpy(md.GroupId,MQMI_NONE , sizeof(md.GroupId)); to memcpy(md.GroupId,MQGI_NONE , sizeof(md.GroupId)); later Roger... At 12:01 AM 1/16/2003, you wrote:
Hi all, Let me explain the scenario I have 3 MQ series client. All 3 clients post the messages on the same queue . The idea is, whoever posted the message only they should get the response for that message. To do that I group the messages by CorrelId, For Client1 the CorrelId is COR1 Client2 the CorrelId is COR2 When is call MQGET function I should only the messages which are matching The CorrelId. This block of code is for getting message from Q. memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId)); memcpy(md.CorrelId, "COR1", sizeof(md.CorrelId)); memcpy(md.GroupId,MQMI_NONE , sizeof(md.GroupId)); md.Encoding = MQENC_NATIVE; md.CodedCharSetId = MQCCSI_Q_MGR; md.Version = MQMD_VERSION_2; gmo.Version = MQGMO_VERSION_2; gmo.MatchOptions = MQMO_MATCH_CORREL_ID ; gmo.WaitInterval = 11000; MQGET(Hcon, /* connection handle */ Hobj, /* object handle */ &md, /* message descriptor */ &gmo, /* get message options */ buflen, /* buffer length */ buffer, /* message buffer */ &messlen, /* message length */ &CompCode, /* completion code */ &Reason); /* reason code */ The MQGET just returned with out any error. It could not find the matching CorrelId I have attched the those 2 files which put the message and get the message. Waiting for ur response Thanks in Advance Murugesan
Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive