mqClearBag

The mqClearBag call deletes all user items from the bag, and resets system items to their initial values.


Syntax for mqClearBag

    mqClearBag (Bag, CompCode, Reason)


Parameters for mqClearBag

    Bag (MQHBAG) - input
    Handle of the bag to be cleared. This must be the handle of a bag created by the user, not the handle of a system bag. MQRC_SYSTEM_BAG_NOT_ALTERABLE results if we specify the handle of a system bag.

    CompCode (MQLONG) - output
    Completion code.

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

      MQRC_HBAG_ERROR
      Bag handle not valid.

      MQRC_SYSTEM_BAG_NOT_ALTERABLE
      System bag cannot be altered or deleted.


Usage notes for mqClearBag

  1. If the bag contains system bags, they are also deleted.
  2. The call cannot be used to clear system bags.


C language invocation for mqClearBag

mqClearBag (Bag, &CompCode, &Reason);
Declare the parameters as follows:
MQHBAG   Bag;           /* Bag handle */
MQLONG   CompCode;      /* Completion code */
MQLONG   Reason;        /* Reason code qualifying CompCode */


Visual Basic invocation for mqClearBag

(Supported on Windows only.)

mqClearBag Bag, CompCode, Reason
Declare the parameters as follows:
Dim Bag      As Long 'Bag handle'
Dim CompCode As Long 'Completion code'
Dim Reason   As Long 'Reason code qualifying CompCode'
Parent topic: MQAI calls