MQ

 View Only
Expand all | Collapse all

MQRC_NO_MSG_AVAILABLE for channel commands via PCF

  • 1.  MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Tue May 03, 2022 10:34 AM
    As we know channel related 'query' PCF commands put multiple messages. is there way we know that how many messages are in the queue up front from PCF structures  before reading it?

    regards,
    deb

    ------------------------------
    Debabrata Ghosh
    ------------------------------


  • 2.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    IBM Champion
    Posted Tue May 03, 2022 12:08 PM

    Hi Debabrata,

    Do you mean

    how many messages are on the queue if so you can use inq queue-depth,
    or did you mean there was one PCF query, how many responses did it send?  There could be responses from 2 PCF queries, so you cannot just look at the curdepth.

    Colin



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



  • 3.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Tue May 03, 2022 02:49 PM
    Hi Colin.
      thank you. I am issuing MQCMD_INQUIRE_CHANNEL_INIT, I wanted to know how many times I have to do MQGET.
     
    regards,
    deb

    ------------------------------
    Debabrata Ghosh
    ------------------------------



  • 4.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Tue May 03, 2022 03:26 PM
    Edited by Rich Harran Tue May 03, 2022 03:26 PM

    Hi Deb,

    You don't know in advance how many times you will need to do MQGET, but the last PCF response will have the Control field in the PCF header set to MQCFC_LAST (1), so you can tell when you have all the responses. There is also a MsgSeqNumber field in the PCF header which is one in the first response, two in the second response and so on.
    See this https://www.ibm.com/docs/en/ibm-mq/9.2?topic=mq-extended-responses document page for some more information about the PCF extended response returned by a z/OS queue manager, and https://www.ibm.com/docs/en/ibm-mq/9.2?topic=mq-standard-responses for the PCF standard responses returned on other platforms.

    Thanks



    ------------------------------
    Rich Harran
    ------------------------------



  • 5.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Tue May 03, 2022 05:03 PM
    Hi Richard,  
        thank you.. , but can I not read until i get a message MQRC_NO_MSG_AVAILABLE  from MQGET ?

    regards,
    deb


    ------------------------------
    Debabrata Ghosh
    ------------------------------



  • 6.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Wed May 04, 2022 02:34 AM
    Edited by Rich Harran Wed May 04, 2022 02:43 AM

    Hi Deb,

    It is possible to get MQRC_NO_MSG_AVAILABLE before getting the last message if not all the responses have arrived on the queue yet. You would also have to do one extra MQGET after you have processed the last response, which can be avoided if you check the Control field.

    Perhaps I misunderstood your question as I thought you were trying to avoid relying on MQRC_NO_MSG_AVAILABLE. Are you asking if there is a predetermined number of expected responses for each PCF command that could be documented and hard-coded in the application? If so then there is not in general.

    Thanks



    ------------------------------
    Rich Harran
    ------------------------------



  • 7.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    IBM Champion
    Posted Wed May 04, 2022 03:19 AM
    and on z/OS it can get more complex if you are in a QSG, as you get sets of responses from multiple queue managers.
    See Understanding PCF cmdscope on z/OS  and Hell is PCF
    Colin

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



  • 8.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Wed May 04, 2022 05:57 PM
    thanks Colin!

    ------------------------------
    Debabrata Ghosh
    ------------------------------



  • 9.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Wed May 04, 2022 09:11 AM
    Hi Richard. 
      thank you. Richard. 

    Regards
    Deb

    ------------------------------
    Debabrata Ghosh
    ------------------------------



  • 10.  RE: MQRC_NO_MSG_AVAILABLE for channel commands via PCF

    Posted Thu May 05, 2022 09:30 AM
    With my PCF coding, I also count the reply messages I get back and validate that number matches the msgSeqNumber in the MQCFC_LAST message, and report an error if those numbers do not match up.

    ------------------------------
    Tim Zielke
    ------------------------------