For an application to work with WebSphere MQ Everyplace , it must first establish a session with the WebSphere MQ Everyplace system. This is achieved by calling the MQeInitialize API and saving the returned MQEHSESS for use on later WebSphere MQ Everyplace API calls.
When the application has finished making WebSphere MQ Everyplace calls, it can terminate its connection to WebSphere MQ Everyplace by calling MQeTerminate (passing the session handle MQEHSESS as a parameter).
The following sample code fragment shows a session initialization and termination.
#include <hmq.h> MQEHSESS hSess; MQEINT32 compcode; MQEINT32 reason; hSess = MQeInitialize("MyAppsName", &compcode, &reason); if (hSess!=MQEHANDLE_NULL) { MQeTerminate(hSess, &compcode, &reason); }