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 » WebSphere Message Broker (ACE) Support » fail to print the MQMD contents from router exit

Post new topic  Reply to topic
 fail to print the MQMD contents from router exit « View previous topic :: View next topic » 
Author Message
nilendu
PostPosted: Wed Sep 20, 2006 2:39 am    Post subject: fail to print the MQMD contents from router exit Reply with quote

Novice

Joined: 14 Sep 2006
Posts: 16

Hi All,


I have written a message router exit.
The structure MQPXP that is passed to the exit funtion is PMQMD or pointer to the MQMD structure.

I would like to print the contents of the MQMD structure.
I could successfully print the variables of type long or integer, but failed to print the char/unsigned char variables.

for e.g:

following variables could be printed successfully:

MQLONG Offset; /* Offset of data in physical message from start of logical message */
MQLONG MsgFlags; /* Message flags */
MQLONG OriginalLength; /* Length of original message */


But couldnt print the these variables:

MQCHAR48 ReplyToQ; /* Name of reply queue */
MQCHAR48 ReplyToQMgr; /* Name of reply queue manager */
MQCHAR12 UserIdentifier; /* User identifier */
MQBYTE24 MsgId; /* Message identifier */


On using memcopy or strcpy to copy the content of the struct to a local variable, I get an access violation error 'amqfcxba.exe has encountered a problem and need to close....'
And a blank values is returned if we try to print the contents directly:

fprintf(fp,"ReplyToQ %s",pExitParm->MsgDescPtr->ReplyToQ);




Surprisingly I could print the 'char' variables that are part of the MQPXP
structure.

i.e I could print the value of 'DestinationQMgrName' from the below struct but not 'PutDate'


struct MQPXP {
.....
MQCHAR48 DestinationQMgrName;
PMQMD MsgDescPtr;
.....

}

struct MQMD {
....
MQCHAR8 PutDate;
....
}






Here is my exit code

void MQENTRY RoutingExit(PMQPXP pExitParm)
{

MQCHAR48 ReplyToQ;


strcpy(ReplyToQ,pExitParm->MsgDescPtr->ReplyToQ); //VIOLATION

memcpy(ReplyToQ,pExitParm->MsgDescPtr->ReplyToQ,sizeof(MQCHAR48));

fp =fopen("C:\\MESSAGEEXIT.TXT","w");

fprintf(fp,"ReplyToQ %s",ReplyToQ);

fprintf(fp,"DestinationQMgrName %s",pExitParm->DestinationQMgrName); /// PRINTED SUCCESSFULLY

fclose(fp);


}



Has anyone tried to print the contents of the MQPXP struct?
What am I doing wrong?
Please advice...

thanks and regards,
Nilendu
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 20, 2006 3:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I wonder what print does if you send it a null value?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Sep 20, 2006 4:08 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

character variables in MQMD are NOT null terminated strings ... strcpy will not work....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
nilendu
PostPosted: Wed Sep 20, 2006 9:24 pm    Post subject: Reply with quote

Novice

Joined: 14 Sep 2006
Posts: 16

Hi jefflowrey,

The contents of the variable is not null. I have tried with the following check as well

Please advice!!

if(pExitParm->MsgDescPtr->ReplyToQ!=NULL)
{
fprintf(fp,"NOT NULL");
fprintf(fp,"ReplyToQ %s",pExitParm->MsgDescPtr->ReplyToQ); //I get a blank output.
}


Hi wschutz,


How about memcpy? Will that work?

Please advice!!!

regards,
Nilendu
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Sep 21, 2006 1:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

http://cm.bell-labs.com/cm/cs/cbook/
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
nilendu
PostPosted: Fri Sep 22, 2006 3:29 am    Post subject: Reply with quote

Novice

Joined: 14 Sep 2006
Posts: 16

wschutz,

Thanks for your crisp and to the point answer.

regards,
Nilendu
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 » WebSphere Message Broker (ACE) Support » fail to print the MQMD contents from router exit
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.