mqPutBag

The mqPutBag call converts the contents of the specified bag into a PCF message and sends the message to the specified queue. The contents of the bag are unchanged after the call.


Syntax for mqPutBag

    mqPutBag (Hconn, Hobj, MsgDesc, PutMsgOpts, Bag, CompCode, Reason)


Parameters for mqPutBag

    Hconn (MQHCONN) - input
    MQI connection handle.

    Hobj (MQHOBJ) - input
    Object handle of the queue on which the message is to be placed. This handle was returned by a preceding MQOPEN call issued by the application. The queue must be open for output.

    MsgDesc (MQMD) - input/output
    Message descriptor. (For more information, see MQMD - Message descriptor.)

    If the Format field has a value other than MQFMT_ADMIN, MQFMT_EVENT, or MQFMT_PCF, MQRC_FORMAT_NOT_SUPPORTED results.

    If the Encoding field has a value other than MQENC_NATIVE, MQRC_ENCODING_NOT_SUPPORTED results.

    PutMsgOpts (MQPMO) - input/output
    Put-message options. (For more information, see MQPMO - Put-message options.)

    Bag (MQHBAG) - input
    Handle of the data bag to be converted to a message.

    If the bag contains an administration message, and mqAddInquiry was used to insert values into the bag, the value of the MQIASY_COMMAND data item must be an INQUIRE command recognized by the MQAI; MQRC_INQUIRY_COMMAND_ERROR results if it is not.

    If the bag contains nested system bags, MQRC_NESTED_BAG_NOT_SUPPORTED results.

    CompCode (MQLONG) - output
    Completion code.

    Reason (MQLONG) - output
    Reason code qualifying CompCode. The following reason codes indicating error and warning conditions can be returned from the mqPutBag call:

      MQRC_*
      Anything from the MQPUT call or bag manipulation.

      MQRC_BAG_WRONG_TYPE
      Input data bag is a group bag.

      MQRC_ENCODING_NOT_SUPPORTED
      Encoding not supported (value in Encoding field in MQMD must be MQENC_NATIVE).

      MQRC_FORMAT_NOT_SUPPORTED
      Format not supported (name in Format field in MQMD must be MQFMT_ADMIN, MQFMT_EVENT, or MQFMT_PCF).

      MQRC_HBAG_ERROR
      Bag handle not valid.

      MQRC_INQUIRY_COMMAND_ERROR
      mqAddInquiry call used with a command code that is not a recognized INQUIRE command.

      MQRC_NESTED_BAG_NOT_SUPPORTED
      Input data bag contains one or more nested system bags.

      MQRC_PARAMETER_MISSING
      Administration message requires a parameter that is not present in the bag. This reason code occurs for bags created with the MQCBO_ADMIN_BAG or MQCBO_REORDER_AS_REQUIRED options only.

      MQRC_SELECTOR_WRONG_TYPE
      mqAddString or mqSetString was used to add the MQIACF_INQUIRY selector to the bag.

      MQRC_STORAGE_NOT_AVAILABLE
      Insufficient storage available.


C language invocation for mqPutBag

mqPutBag (HConn, HObj, &MsgDesc, &PutMsgOpts, Bag,
&CompCode, &Reason);
Declare the parameters as follows:
MQHCONN  HConn;         /* MQI connection handle */
MQHOBJ   HObj;          /* Object handle */
MQMD     MsgDesc;       /* Message descriptor */
MQPMO    PutMsgOpts;    /* Put-message options */
MQHBAG   Bag;           /* Bag handle */
MQLONG   CompCode;      /* Completion code */
MQLONG   Reason;        /* Reason code qualifying CompCode */


Visual Basic invocation for mqPutBag

(Supported on Windows only.)

mqPutBag (HConn, HObj, MsgDesc, PutMsgOpts, Bag,
CompCode, Reason);
Declare the parameters as follows:
Dim HConn      As Long  'MQI connection handle'
Dim HObj       As Long  'Object handle'
Dim MsgDesc    As MQMD  'Message descriptor'
Dim PutMsgOpts As MQPMO 'Put-message options'
Dim Bag        As Long  'Bag handle'
Dim CompCode   As Long  'Completion code'
Dim Reason     As Long  'Reason code qualifying CompCode'
Parent topic: MQAI calls