MQCBC - Callback context

The MQCBC structure is used to specify context information that is passed to a callback function. The structure is an input/output parameter on the call to a message consumer routine.

Availability

The MQCBC structure is available on the following platforms:
  • [AIX]AIX®
  • [IBM i]IBM® i
  • [Linux]Linux®
  • [Windows]Windows
  • [z/OS]z/OS®
and for IBM MQ MQI clients connected to these systems.

Version

The current version of MQCBC is MQCBC_VERSION_2.

Character set and encoding

Data in MQCBC must be in the character set given by the CodedCharSetId queue manager attribute and encoding of the local queue manager given by MQENC_NATIVE. However, if the application is running as an MQ MQI client, the structure will be in the character set and encoding of the client.

Fields

Notes:
  • In the following table, the fields are grouped by usage rather than alphabetically.
  • There are no initial values for the MQCBC structure. The structure is passed as a parameter to a callback routine. The queue manager initializes the structure; applications never initialize it.
Table 1. Fields in MQCBC
Field Description
StrucID Structure identifier
Version Structure version number
CallType Why function has been called
Hobj Object handle
CallbackArea Field for callback function to use
ConnectionArea Field for callback function to use
CompCode Completion code
Reason Reason code
State Indication of the state of the current consumer
DataLength Message length
BufferLength Length of message buffer in bytes
Flags General flags
Note: The remaining field is ignored if Version is less than MQCBC_VERSION_2
ReconnectDelay Number of milliseconds before reconnection attempt

Language declarations

C declaration for MQCBC

typedef struct tagMQCBC MQCBC;
struct tagMQCBC {
   MQCHAR4   StrucId;                 /* Structure identifier */
   MQLONG    Version;                 /* Structure version number */
   MQLONG    CallType;                /* Why Function was called */
   MQHOBJ    Hobj;                    /* Object Handle */
   MQPTR     CallbackArea;            /* Callback data passed to the function */
   MQPTR     ConnectionArea;          /* MQCTL data area passed to the function */
   MQLONG    CompCode;                /* Completion Code */
   MQLONG    Reason;                  /* Reason Code */
   MQLONG    State;                   /* Consumer State */
   MQLONG    DataLength;              /* Message Data Length */
   MQLONG    BufferLength;            /* Buffer Length */
   MQLONG    Flags;                   /* Flags containing information about
                                         this consumer */
  /* Ver:1 */
   MQLONG    ReconnectDelay;          /* Number of milliseconds before */
  /* Ver:2 */  };                     /* reconnect attempt */

COBOL declaration for MQCBC

** MQCBC structure
 10  MQCBC.
** Structure Identifier 
 15  MQCBC-STRUCID                      PIC X(4).
** Structure Version
 15  MQCBC-VERSION                      PIC S9(9) BINARY.
 ** Call Type
 15  MQCBC-CALLTYPE                     PIC S9(9) BINARY.
** Object Handle
 15  MQCBC-HOBJ                         PIC S9(9) BINARY.
** Callback User Area
 15  MQCBC-CALLBACKAREA                 POINTER
** Connection Area    
 15  MQCBC-CONNECTIONAREA               POINTER
** Completion Code
 15  MQCBC-COMPCODE                     PIC S9(9) BINARY.
** Reason Code 
 15  MQCBC-REASON                       PIC S9(9) BINARY.
** Consumer State     
 15  MQCBC-STATE                        PIC S9(9) BINARY.
** Data Length
 15  MQCBC-DATALENGTH                   PIC S9(9) BINARY.
** Buffer Length
 15  MQCBC-BUFFERLENGTH                 PIC S9(9) BINARY.
** Flags
 15  MQCBC-FLAGS                        PIC S9(9) BINARY.
** Ver:1 **
** Number of milliseconds before reconnect attempt
 15  MQCBC-RECONNECTDELAY PIC S9(9) BINARY.
** Ver:2 **

PL/I declaration for MQCBC

dcl
 1 MQCBC based,
  3 StrucId             char(4),       /* Structure identifier */
  3 Version             fixed bin(31), /* Structure version */
  3 CallType            fixed bin(31), /* Callback type */
  3 Hobj                fixed bin(31), /* Object Handle */
  3 CallbackArea        pointer,       /* User area passed to the function */
  3 ConnectionArea      pointer,       /* Connection User Area */
  3 CompCode            fixed bin(31); /* Completion Code */
  3 Reason              fixed bin(31); /* Reason Code */
  3 State               fixed bin(31); /* Consumer State */
  3 DataLength          fixed bin(31); /* Message Data Length */
  3 BufferLength        fixed bin(31); /* Message Buffer length */
  3 Flags               fixed bin(31); /* Consumer Flags */
/* Ver:1 */
  3 ReconnectDelay      fixed bin(31); /* Number of milliseconds before */
/* Ver:2 */                            /* reconnect attempt */

High Level Assembler declaration for MQCBC

    MQCBC                 DSECT
    MQCBC                 DS  0F    Force fullword alignment
    MQCBC_STRUCID         DS  CL4   Structure identifier
    MQCBC_VERSION         DS  F     Structure version number
    MQCBC_CALLTYPE        DS  F     Why Function was called
    MQCBC_HOBJ            DS  F     Object Handle
    MQCBC_CALLBACKAREA    DS  A     Callback data passed to the function
    MQCBC_CONNECTIONAREA  DS  A     MQCTL Data area passed to the function
    MQCBC_COMPCODE        DS  F     Completion Code
    MQCBC_REASON          DS  F     Reason Code
    MQCBC_STATE           DS  F     Consumer State
    MQCBC_DATALENGTH      DS  F     Message Data Length
    MQCBC_BUFFERLENGTH    DS  F     Buffer Length
    MQCBC_FLAGS           DS  F     Flags containing information about this consumer
    MQCBC_RECONNECTDELAY  DS  F     Number of milliseconds before reconnect  
    MQCBC_LENGTH          EQU *-MQCBC
                          ORG       MQCBC
    MQCBC_AREA            DS  CL(MQCBC_LENGTH)