mqAddBag

The mqAddBag call nests a bag in another bag.


Syntax for mqAddBag

mqAddBag (Bag, Selector, ItemValue, CompCode, Reason)


Parameters for mqAddBag

    Bag (MQHBAG) - input
    Bag handle into which the item is to be added.

    The bag must be a user bag. This means that it must have been created using the MQCBO_USER_BAG option on the mqCreateBag call. If the bag was not created in this way, MQRC_WRONG_BAG_TYPE results.

    Selector (MQLONG) - input
    Selector identifying the item to be nested.

    If the selector is less than zero (that is, a system selector), MQRC_SELECTOR_OUT_OF_RANGE results.

    If the selector is zero or greater (that is, a user selector) and the bag was created with the MQCBO_CHECK_SELECTORS option, the selector must be in the range MQGA_FIRST through MQGA_LAST; if not, again MQRC_SELECTOR_OUT_OF_RANGE results.

    If MQCBO_CHECK_SELECTORS was not specified, the selector can be any value of zero or greater.

    If the call is creating a second or later occurrence of a selector that is already in the bag, the data type of this occurrence must be the same as the data type of the first occurrence; MQRC_INCONSISTENT_ITEM_TYPE results if it is not.

    ItemValue (MQHBAG) - input
    The bag which is to be nested.

    If the bag is not a group bag, MQRC_BAG_WRONG_TYPE results. If an attempt is made to add a bag to itself, MQRC_HBAG_ERROR results.

    CompCode (MQLONG) - output
    Completion code.

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

      MQRC_BAG_WRONG_TYPE
      Wrong type of bag for intended use (either Bag or ItemValue).

      MQRC_HBAG_ERROR
      Bag handle not valid.

      MQRC_INCONSISTENT_ITEM_TYPE
      Data type of this occurrence of selector differs from data type of first occurrence.

      MQRC_SELECTOR_OUT_OF_RANGE
      Selector not within valid range for call.

      MQRC_STORAGE_NOT_AVAILABLE
      Insufficient storage available.


Usage notes for mqAddBag

If a bag with the specified selector is already present in the bag, an additional instance of that selector is added to the end of the bag. The new instance is not necessarily adjacent to the existing instance.


C language invocation for mqAddBag

mqAddBag (Bag, Selector, ItemValue, &CompCode, &Reason)
Declare the parameters as follows:
MQHBAG   Bag;       /* Bag handle */
MQLONG   Selector;  /* Selector */
MQHBAG   ItemValue; /* Nested bag handle */
MQLONG   CompCode;  /* Completion code */
MQLONG   Reason;    /* Reason code qualifying CompCode */


Visual Basic invocation for mqAddBag

(Supported on Windows only.)

mqAddGroup Bag, Selector, ItemValue, CompCode, Reason
Declare the parameters as follows:
Dim Bag       As Long 'Bag handle'
Dim Selector  As Long 'Selector'
Dim ItemValue As Long 'Nested bag handle'
Dim CompCode  As Long 'Completion code'
Dim Reason    As Long 'Reason code qualifying CompCode'
Note: The mqAddBag call can be used with user bags only; we cannot add nested bags to administration or command bags. We can only nest group bags. Parent topic: MQAI calls