Coding the bound calls

MQI ILE procedures are listed in Table 3.

Table 3. ILE RPG bound calls supported by each service program
Name of call LIBMQM and LIBMQM_R AMQZSTUB AMQVSTUB
MQBACK Y    
MQBEGIN Y    
MQCMIT Y    
MQCLOSE Y Y  
MQCONN Y Y  
MQCONNX Y    
MQDISC Y Y  
MQGET Y Y  
MQINQ Y Y  
MQOPEN Y Y  
MQPUT Y Y  
MQPUT1 Y Y  
MQSET Y Y  
MQXCNVC Y   Y

To use these procedures we need to:

  1. Define the external procedures in your 'D' specifications. These are all available within the COPY file member CMQG containing the named constants.

  2. Use the CALLP operation code to call the procedure along with its parameters.

For example the MQOPEN call requires the inclusion of the following code:

   D******************************************************************
   D**  MQOPEN Call -- Open Object  (From COPY file CMQG)           **
   D******************************************************************
   D*
   D*..1....:....2....:....3....:....4....:....5....:....6....:....7..
   DMQOPEN           PR                  EXTPROC('MQOPEN')
   D* Connection handle
   D HCONN                         10I 0 VALUE
   D* Object descriptor
   D OBJDSC                       224A
   D* Options that control the action of MQOPEN
   D OPTS                          10I 0 VALUE
   D* Object handle
   D HOBJ                          10I 0
   D* Completion code
   D CMPCOD                        10I 0
   D* Reason code qualifying CMPCOD
   D REASON                        10I 0
   D*

To call the procedure, after initializing the various parameters, we need the following code:

 ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+....8
     C                   CALLP     MQOPEN(HCONN : MQOD : OPTS : HOBJ :
     C                             CMPCOD : REASON)

Here, the structure MQOD is defined using the COPY member CMQODG which breaks it down into its components.