Thanks Paul,
Will do it that way. I was thinking that at MQXR_TERM time I would have the
exitBuffer address with me so that I could free it off..anyway this looks to
be a solution. In my case the pointer would have to be reallocated for every
MQXR_MSG call because I would not know what was the message size for the
message coming in. So what I would do is with every MQXR_MSG call i will
reallocate the memory and the returned pointer i would store like you say
and in the next exit call, i can free that memory and reallocate again.

If there are no more messages and the MQXR_TERM is called i can check for
the memory already allocated and free the fellow.

Thanks Paul.
Kind Regards
Aby Philip
-----Original Message-----
From: Paul Clarke
To: [EMAIL PROTECTED]
Sent: 9/5/02 4:16 AM
Subject: Re: Message exit length for alteration

>Hi,
>I also noticed that in the documentation there is a mention that the
>previous exitBuffer address is returned in the next invocation of the
>message exit, so I guess I can free the memory then...That should be
>fine...but in any case if there is something wrong with this
approach...or
>if there is any other way ...that would be nice to know.

>Thanks
>Kind Regards
>Aby Philip

Aby,

No this isn't really the right solution. You are not guaranteed to be
called again with MQXR_MSG and therefore this could leak.

Exits are always passed a Channel Exit Parameter structure containing a
16
byte field ExitUserArea. This field should be used to store a pointer to
any state information the exit may have. This is really true for all
exits.
The reason it is 16 bytes is that OS/400 has 16 byte pointers.

In your case the state information is the Exit buffer address. I would
recommend you allocate a structure for all your state information at
MQXR_INIT time. One of the fields in this structure would be a place for
you to store your exit buffer pointer if you've allocated one. Perhaps
you
might also want to store things like the length of the buffer etc. At
MQXR_TERM time you should look to see whether this buffer pointer has
been
set and if so free it and then free the state structure itself.

Hope this helps,
P.

Paul G Clarke
WebSphere MQ Development
IBM Hursley

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

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

Reply via email to