3
votes

Has anyone worked with MQ from RPG? The problem is as follows. There are several messages in the queue. All of them are with RFH2 header. Each header contains a set of NameValueData. I am creating a Message Handle and passing it to MQGET. Then I retrieve Properties using MQINQMP. Question. When I read several messages in a loop, using the same Message Handle instance for all (without freeing it and re-creating it for each message), will I have memory leaks?

1
This seems like a loaded question - are you seeing the possibility of memory leaks and have identified this as a possibility? Clearly IBM did not design the interface to have memory leaks, but there may be a defect in there that has not been fixed. - Morag Hughson

1 Answers

4
votes

The IBM MQ Message Properties API is designed to be used in the following way.

MQOPEN
MQCRTMH

start-loop

MQGET
MQINQMP

end-loop

MQCLOSE
MQDLTMH

You can see this demonstrated in the IBM supplied 'C' sample amqsbcg0.c. I know your question is for RPG, but the underlying API is meant to work the same for all languages.