ibm-mqrpglerfh2

Using one Message Handle for several MQ message cause memory leaks?


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?


Solution

  • 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.