MQI Calls in OSC
This appendix describes what must be noted when migrating from IBM MQ to OSC applications.
1. What must be noted when calling MQI in OSC
Accessing IBM MQ from OSC requires MQI interfaces provided by MQ. First, call MQCONN by specifying the name of a QUEUE admin to access. If the connection with the QUEUE admin is successful, the connection handle value is returned. An then, different MQIs such as MQOPEN, MQGET, MQPUT, MQCMIT, MQBACK and MQCLOSE receive the connection handle value as input.
An OSC application accesses MQ by either calling directly MQCONN or using the MQ connection functions provided by OSC. When directly calling MQCONN, the connection handle returned during the call can be used. When using the OSC’s connection functions, you need to use the connection handle value returned during the connection between OSC and MQ to call an MQI.
OSC provides an API that returns connection handles for MQ.
void OSC_GET_MQ_HANDLE(int32_t *connid);
If the connection to MQ is successful, an MQ connection handle is returned. If failed, -1 is returned.
The following example uses MQ from an OSC application.
IDENTIFICATION DIVISION. PROGRAM-ID. TESTMQ01. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-MQ-HCONN PIC S9(9) COMP VALUE +0. PROCEDURE DIVISION. CALL 'OSC_GET_MQ_HANDLE' USING WS-MQ-HCONN. CALL 'MQOPEN' USING WS-MQ-HCONN MQOD WS-MQ-OPTIONS WS-MQ-HMQOD WS-MQ-COMPCODE WS-MQ-REASON.