MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Control block defaults

    Posted Thu January 27, 2022 03:39 AM
    Ive spent some time debugging a problem which came down to
    #define MQGMO_DEFAULT {MQGMO_STRUC_ID_ARRAY},\
             MQGMO_VERSION_1,\
            (MQGMO_NO_WAIT+MQGMO_PROPERTIES_AS_Q_DEF),\

    With MQGMO_VERSION_1 fields like MsgHandle are ignored, and I get a return code  2460 mqrc hmsg error.
    (Ive raised a doc comment saying this rc is not documented for get - and to give the explanation)

    Would it be better if it was
    #define MQGMO_DEFAULT {MQGMO_STRUC_ID_ARRAY},\
            MQGMO_CURRENT_VERSION ,\
            (MQGMO_NO_WAIT+MQGMO_PROPERTIES_AS_Q_DEF),\

    I know this might cause migration problems which would be hard to track down - but the current was not easy to debug

    Similar for PMO etc.

    regards

    Colin

    ------------------------------
    Colin Paice
    ------------------------------


  • 2.  RE: Control block defaults

    Posted Thu January 27, 2022 04:24 AM

    Hi Colin,

    This is how the MQI works. If you need to use a field in a particular version of a structure, you must set the version of the structure accordingly. As it says in the description of the Version field:-

    Fields that exist only in the more-recent versions of the structure are identified as such in the descriptions of the fields.

    I suspect this is not fully adhered to in all field descriptions. However the MQGMO.MsgHandle field does say:-

    This is an always an input field. The initial value of this field is MQHM_NONE. This field is ignored if Version is less than MQGMO_VERSION_4.

    Cheers,
    Morag



    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    Website: https://www.mqgem.com
    ------------------------------



  • 3.  RE: Control block defaults

    Posted Thu January 27, 2022 07:41 AM
    The MQI has worked that way for about 30 years ... it ensures that your application does not change behaviour simply by recompiling it against a newer level of the definitions.

    When you look in files like cmqc.h you can see which version of a structure is needed in order to use a particular field. Just underneath the MsgHandle declaration, for example, you can see the comment "Ver:4".

    ------------------------------
    Mark Taylor
    Winchester
    ------------------------------