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
Expand all | Collapse all

How long's the MQOD on z/OS - it depends

  • 1.  How long's the MQOD on z/OS - it depends

    Posted Thu December 30, 2021 10:36 AM

    I've been compiling a program on z/OS and found the length of the MQOD (and others)  are not what I expect.
    If I compile with 31 bit I get an MQOD with length 400 which matches the MQOD_CURRENT_LENGTH  in the CMQC.H (There is only one MQOD_CURRENT_LENGTH in the file).

    If I compile with 64 bit, I get an MQOD with length 422.

    If I look at the QMQC.h on midrange it has

    #if defined(MQ_64_BIT)
    #define MQOD_CURRENT_LENGTH 424
    #else
    #define MQOD_CURRENT_LENGTH 400
    #endif

    Which is what I expect...

    do I need a special compile option for z/OS to force pointers to be 31 bit ?

    Colin



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


  • 2.  RE: How long's the MQOD on z/OS - it depends

    Posted Thu December 30, 2021 08:45 PM
    Edited by Morag Hughson Fri December 31, 2021 11:09 PM

    When I build a C program, on z/OS, in 64-bit, that prints out the size of the MQOD structure, it says it is 424 bytes.

    Perhaps you can share your code and your build options so we can understand how you got 422 which is not even divisible by 4!

    You ask for a special compile option to force pointers to be 31-bit. I'm not sure exactly what you mean there. You already said you built it 31-bit and and got the expected length of 400 in that situation. What more do you want the special option to do beyond that? Perhaps expand on your requirement so we can help further.

    I agree that it would be nice if the z/OS version of the CMQC header file had the same pairs of #defined constants too, after all they have other #if defined(_LP64) statements in the header file. Would be nice just for consistency, but I have to say that I have rarely used those constants, and just use sizeof() when I need the length. If you use them, perhaps it would be worth raising an IDEA (a new process replacing RFE - read more in Mark Taylor's post about the new RFE system)

    ​Cheers,
    Morag​

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



  • 3.  RE: How long's the MQOD on z/OS - it depends

    Posted Fri December 31, 2021 03:11 AM
    Hi Morag,

    Thanks for your reply... the 422 is a typo.. is it 424.   My problem is the MQOD_CURRENT_LENGTH 400.

    I am porting some code, and the code checks to see if the MQOD passed to it is the right size.
    It compares 424 with MQOD_CURRENT_LENGTH and it reports an error.

    I was surprised that no one had reported this before, so I assumed I had the wrong compile options.

    I guess I'll have to put the #ifdef's in manually.

    regards

    Colin





  • 4.  RE: How long's the MQOD on z/OS - it depends

    Posted Fri December 31, 2021 10:38 PM
    Edited by Morag Hughson Fri December 31, 2021 11:10 PM

    I guess no-one has built this code on z/OS before. Perhaps you could show us a snippet of the code so we understand what you're grappling with. Is the parameter in question coming from an external source? i.e. how come the application can't trust that the  MQOD passed to it is the full current length, is it because the source of the parameter can be built with a different version of the header files and thus be a different length?

    Certainly it sounds like putting in the #ifdef's yourself will solve the problem if you need those lengths.

    In my earlier response I linked to Mark Taylor's blog post that describes the change from the old RFE process to the new IDEA process. However, I have been told that his blog is black-listed by some companies, so for completion, here is the link to the IDEA process directly. I will update my prior response to include both. I'll also see if Mark is willing to write his blog post on the IBM Community so everyone can see it.

    EDIT: Looks like he already did, so I have edited my previous response to include the link to the IBM Community version of the post.

    Cheers,
    Morag



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



  • 5.  RE: How long's the MQOD on z/OS - it depends

    Posted Sat January 01, 2022 10:47 AM
    Hi Morag,
    I'll raise an IDEA for this.

    The code is pymqi (Python MQI code).  It looks good resilient code, making sure the length of the control block is as expected.
    It has code to generate the MQOD, then says .. if MQ release > 7 then add  to the MQOD,  the ObjectString, SelectionString etc.
    The length check is good to make sure it is consistent, and not missing a field.

    Here are some code excerpts.


    #define PYMQI_MQOD_SIZEOF MQOD_CURRENT_LENGTH
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    //  qDescBufferLength is the length of the(MQOD) object passed in
    if (checkArgSize(qDescBufferLength, PYMQI_MQOD_SIZEOF, "MQOD")) {
    return NULL;
    }


    static int checkArgSize(Py_ssize_t given, Py_ssize_t expected, const char *name) {
    if (given != expected) {
    PyErr_Format(ErrorObj, "%s wrong size. Given: %lu, expected %lu", name, (unsigned long)given, (unsigned long)expected);
    return 1;
    }
    return 0;
    }

    regards

    Colin

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



  • 6.  RE: How long's the MQOD on z/OS - it depends

    Posted Mon January 03, 2022 01:26 PM

    and the MQMD's are different sizes...
    on midrange the MQMD is a V2, on z/OS is is a V1!

    I'll raise another IDEA  to make these compatible.



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



  • 7.  RE: How long's the MQOD on z/OS - it depends

    Posted Mon January 03, 2022 02:01 PM
    Colin,

    What version of MQ on z/OS are you working with.  I looked at the C definition in 9.1 and in that version the MQMD as defined in the CMQC.H  has MQMD_CURRENT_VERSION is 2.  the MQOD is v4 and it's length for v4 is the 400 bytes.  What is the MQOD version on the open systems side?

    Peter

    ------------------------------
    Peter Vander Woude
    ------------------------------



  • 8.  RE: How long's the MQOD on z/OS - it depends

    Posted Tue January 04, 2022 03:23 AM
    Im on MQ 9.2.4

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



  • 9.  RE: How long's the MQOD on z/OS - it depends

    Posted Mon January 03, 2022 04:38 PM
    If you need a V2 MQMD just use the MQMD2 structure. There we're good reasons why the unversioned MQMD structure wasn't made into a V2 when the V2 MQMD was introduced on z/OS to do with the way COBOL programs pass parameters. 

    Cheers,
    Morag

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



  • 10.  RE: How long's the MQOD on z/OS - it depends

    Posted Tue January 04, 2022 03:30 AM

    I had to change the common code, and change it from MQMD to MQMDv2.  On midrange it is the same structure, and on z/OS it will pick up the V2.

    #ifdef __MVS__
    #define PYMQI_MQMD_SIZEOF sizeof(MQMD2)
    #else
    #define PYMQI_MQMD_SIZEOF sizeof(MQMD)
    #endif

    then it works.



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



  • 11.  RE: How long's the MQOD on z/OS - it depends

    Posted Tue January 04, 2022 04:17 AM

    The MQMD2 structure is defined on distributed as well as z/OS. It is defined so that you don't need to do what you have done, you can have exactly the same code on both platform sets.

    So remove the #ifdefs and just use:-

    #define PYMQI_MQMD_SIZEOF sizeof(MQMD2)

    Cheers,
    Morag



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



  • 12.  RE: How long's the MQOD on z/OS - it depends

    Posted Wed January 05, 2022 03:26 AM

    Good idea... why didn't I think of that!

    Colin



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