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

MQCMD_PING_CHANNEL

  • 1.  MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 03:25 PM
    Edited by Debabrata Ghosh Tue April 12, 2022 06:22 PM
    Hello,
       I am trying to issue  "MQCMD_PING_CHANNEL"  on z/OS for a channel. 
       are these followings below enough to test channel exception condition.  

       I issued the command  against channels with retry status but , I am getting rc=0 from response header. 
       I am trying to see if this command actually show me the real error as we encountered

    769E0291 from manual ping.



    MQRCCF_ALLOCATE_FAILEDAllocation failed.

    MQRCCF_BIND_FAILEDBind failed.

    MQRCCF_CCSID_ERRORCoded character-set identifier error.

    MQRCCF_CHANNEL_CLOSEDChannel closed.

    MQRCCF_CHANNEL_IN_USEChannel in use.

    MQRCCF_CHANNEL_NOT_FOUNDChannel not found.

    MQRCCF_CHANNEL_TYPE_ERRORChannel type not valid.

    MQRCCF_CONFIGURATION_ERRORConfiguration error.

    MQRCCF_CONNECTION_CLOSEDConnection closed.

    MQRCCF_CONNECTION_REFUSEDConnection refused.

    MQRCCF_DATA_TOO_LARGEData too large.

    MQRCCF_ENTRY_ERRORConnection name not valid.

    MQRCCF_HOST_NOT_AVAILABLERemote system not available.

    MQRCCF_NO_COMMS_MANAGERCommunications manager not available.

    MQRCCF_PING_DATA_COMPARE_ERRORPing Channel command failed.

    MQRCCF_PING_DATA_COUNT_ERRORData count not valid.

    MQRCCF_PING_ERRORPing error.

    MQRCCF_RECEIVE_FAILEDReceive failed.

    MQRCCF_RECEIVED_DATA_ERRORReceived data error.

    MQRCCF_REMOTE_QM_TERMINATINGRemote queue manager terminating.

    MQRCCF_REMOTE_QM_UNAVAILABLERemote queue manager not available.

    MQRCCF_SEND_FAILEDSend failed.

    MQRCCF_STRUCTURE_TYPE_ERRORStructure type not valid.

    MQRCCF_TERMINATED_BY_SEC_EXITChannel terminated by security exit.

    MQRCCF_UNKNOWN_REMOTE_CHANNELRemote channel not known.

    MQRCCF_USER_EXIT_NOT_AVAILABLEUser exit not available.
    Regards,
    Deb

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



  • 2.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 06:35 PM

    Hi Deb,

    Some questions to clarify what you mean exactly.

    1. You say you received reason code = x'1' and return code = x'13' from the MQPUT. Do you mean the CompCode and Reason output parameters on the MQPUT call when putting the command message to do the MQCMD_PING_CHANNEL command to the command server queue? Or perhaps you mean the CompCode and Reason fields in the MQCFH header given to you on the response message having successfully MQPUT the message to the command server queue. Could you be more specific about which you mean? Feel free to show us a snippet of the code you are using if that makes it clearer.
    2. You mention encountering 769E0291 from manual ping. Could you please show us the exact output you are seeing on your manual ping.
    3. You haven't told us what platform or what version of MQ you are using. From prior questions, I assume this might be a z/OS queue manager, but you should certainly tell us those details too.

    Cheers,
    Morag



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



  • 3.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 06:47 PM

    While waiting for your answers, I have done some experiments with PING CHANNEL on z/OS myself, and if I have a bad CONNAME (one that will never work) then I get the following error on my MQSC (aka manual) PING.

    CSQN205I COUNT= 2, RETURN=00000000, REASON=00000004
    CSQM134I MQG1 CSQMPCHL PING CHL(MQG1.TO.MQG2) COMMAND ACCEPTED
    CSQN205I COUNT= 6, RETURN=0000000C, REASON=00000008
    CSQX202E MQG1 CSQXPING Connection or remote listener unavailable,
    channel MQG1.TO.MQG2
    connection localhost (127.0.0.1)
    TRPTYPE=TCP RC=00000468 (ECONNREFUSED) reason=769E0291
    CSQ9023E MQG1 CSQXCRPS ' PING CHL' ABNORMAL COMPLETION

    I see the same reason code you mentioned, so I suspect this is what you were talking about. This is not an MQ reason code, it is a TCP/IP reason code. If you want to learn how to decode these you can read more here. However, I can tell you for free that this specific reason code 0291 doesn't add anything to the ECONNREFUSED RC you already have in the error message.

    In short, the reason your channel is retrying and your ping is failing is because the TCP/IP connection is not accepted. Check you have the correct IP address AND port number, and check the listener is running at the target and actually listening on that port number.

    Cheers,
    Morag



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



  • 4.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 07:34 PM
    Hi Morag,
       after the MQGET, I see  MQCFH_COMPCODE  =2   and  MQCFH_REASON  = X'BBE'  
       

    Regards
    deb 


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



  • 5.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 07:55 PM
    Edited by Morag Hughson Tue April 12, 2022 07:56 PM

    Hi Deb,

    The reason code you report X'BBE' is 3006 in decimal which is MQRCCF_CFH_PARM_COUNT_ERROR. This suggests a problem with the parameters you have supplied in your MQCMD_PING_CHANNEL command to the command server. Can you tell us what parameters you supplied please? Perhaps you can show us your code, as this seems to be a coding issue with your command message.

    When I issue the command from PCF, I supply two parameters, an MQCFST for the channel name, and an MQCFIN for the Data length. The second of those is optional.

    Cheers,
    Morag



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



  • 6.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 09:43 PM
    Hi Morag,
        I am setting 2 parameters. string and integer but still same issue.

    regards,
    deb

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



  • 7.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 09:47 PM

    Hi Deb,

    To allow us to help you debug why your code is going wrong, you're going to have to give us a lot more to go on than that. Which two parameters are you setting? Their types are not enough to know what they are. Are you setting the parameter count in the MQCFH to match the number of parameters in your message?

    If you want further assistance, at least show us a snippet of your code showing how you are building this PCF command message.

    Cheers,
    Morag



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



  • 8.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 09:51 PM
    Hi Morag,
     here is the code snippet. having larger buffer length should not matter correct ? 

    -----------------------------
    setting header
    -----------------------------
    L R6,LWA_PCFHDR_PTR
    USING MQCFH,R6
    LA R1,MQCFT_COMMAND_XR
    ST R1,MQCFH_TYPE
    LA R1,MQCFH_STRUC_LENGTH
    ST R1,MQCFH_STRUCLENGTH
    LA R1,MQCFH_VERSION_3
    ST R1,MQCFH_VERSION
    LA R1,MQCMD_PING_CHANNEL
    ST R1,MQCFH_COMMAND
    LA R1,MQCFC_LAST
    ST R1,MQCFH_MSGSEQNUMBER
    LA R1,MQCFC_LAST
    ST R1,MQCFH_CONTROL
    LHI R1,2
    ST R1,MQCFH_PARAMETERCOUNT

    -----------------------------------
    setting string parameter
    ----------------------------------
    L R6,LWA_PCFSTR_PTR
    USING MQCFST,R6
    LA R1,MQCFT_STRING
    ST R1,MQCFST_TYPE
    LA R1,MQCFST_STRUC_LENGTH_FIXED
    AL R1,=AL4(MQ_CHANNEL_NAME_LENGTH)
    ST R1,MQCFST_STRUCLENGTH
    LA R1,MQCACH_CHANNEL_NAME
    ST R1,MQCFST_PARAMETER
    LA R1,MQCCSI_DEFAULT
    ST R1,MQCFST_CODEDCHARSETID
    L R1,@PINGREQ_CHANNEL_LENGTH
    ST R1,MQCFST_STRINGLENGTH
    LR R1,R6
    AL R1,=AL4(MQCFST_STRUC_LENGTH_FIXED)
    MVC 0(20,R1),@PINGREQ_CHANNEL_NAME

    ----------------------------------
    setting integer parameter
    ---------------------------------
    L R6,LWA_PCFINT_PTR
    USING MQCFIN,R6
    LA R1,MQCFT_INTEGER
    ST R1,MQCFIN_TYPE
    LA R1,MQCFIN_STRUC_LENGTH
    ST R1,MQCFIN_STRUCLENGTH
    LA R1,MQIACH_DATA_COUNT
    ST R1,MQCFIN_PARAMETER
    LA R1,16
    ST R1,MQCFIN_VALUE



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



  • 9.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 10:53 PM

    Hi Deb,

    Thanks for those snippets. I can't immediately spot anything wrong there. I can see that you are setting the parameter count to 2. One thing you don't show is how you calculate the position of LWA_PCFINT_PTR given that the MQCFST structure before it is variable in length. It would seem easier just to add MQCFST_STRUCLENGTH to the current R6 to calculate your new R6?

    The other thing I can't check since you don't show it, is that you set the MQCFST_STRINGLENGTH to @PINGREQ_CHANNEL_LENGTH, but your MVC uses a hardcoded 20 to copy the channel name. It's possible that @PINGREQ_CHANNEL_LENGTH is also 20, but I can't tell that from what you've shown.

    You also ask whether "having larger buffer length should not matter" but you don't show what your buffer length is. Are you saying that on the MQPUT call you tell the queue manager that your message is longer than it is? It would seem your message length is the simple addition of MQCFH_STRUC_LENGTH + MQCFST_STRUC_LENGTH_FIXED + MQ_CHANNEL_NAME_LENGTH + MQCFIN_STRUC_LENGTH. I don't think it will matter if the buffer length is longer so long as the buffer is also at least that long, but it should be simple to correct to rule that out as a problem.

    Another thing you could do is put the message you are building to a side queue (instead of the command server queue) and look at it to see if it is correct and that might make it easier to debug. There are plenty of MQ tools out there that can format out a PCF message. If you can't get one, do a browse of the message using something like CSQ4BCG1 sample and then post the output on here so we can see.

    Cheers,
    Morag



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



  • 10.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 11:24 PM
    Hi Morag.
        Thank you. Problem is identified. it is the length while doing PUT.  as soon as I fixed the length- Now I see MQCFH_COMPCODE = 0 , MQCFH_REASON = 0 .   Now I am back to my original question.  Which this PING will return to me so that I know the the issue with the channel.
    do I need parse the MQGET ?  which PCF type will tell me that.

    Regards,
    Deb

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



  • 11.  RE: MQCMD_PING_CHANNEL

    Posted Tue April 12, 2022 11:40 PM
    Edited by Morag Hughson Tue April 12, 2022 11:47 PM

    So when you issue an MQCMD_PING_CHANNEL command you will get three response messages back. The first will have a CFH CompCode and Reason to tell you that the command was successfully issued (not completed, issued). Channel commands are asynchronous.

    The second response in your failing case will have a CFH CompCode and Reason indicating the failure, my example is like this:-

    [ 144 bytes] Message Content
    [ 144 bytes] PCF Header (MQCFH XR)
    Type :17 (XR Message)
    Struc Length :36
    Version :3
    Command :26 (Ping Channel)
    Sequence No. :1
    Control :0 (Not last)
    CompCode :2 (Failed)
    Reason :4010 (Host not available)
    Parm Count :2
    [ 108 bytes] Bytes (MQCFBS)
    Type :9 (Byte String)
    Struc Length :40
    Parameter Id :7004 (Response Id)
    Bytes Length :24
    Value :C3E2D840D4D8C7F1404040E2D4D8C7F1DB58DC7B2D011828
    [ 68 bytes] String (MQCFST)
    Type :4 (String)
    Struc Length :68
    Parameter Id :3070 (Response QMgr Name)
    CCSID :500
    String Length:48
    Value :'MQG1 '

    The third and final response will have a CFH CompCode and Reason indicating the command failed. Not interesting compared to the second response.

    The CFH Reason code in the 2nd response message is the equivalent to your MQSC error message:-

    CSQX202E MQG1 CSQXPING Connection or remote listener unavailable,
    channel MQG1.TO.MQG2
    connection localhost (127.0.0.1)
    TRPTYPE=TCP RC=00000468 (ECONNREFUSED) reason=769E0291

    So, you must, for channel commands, MQGET the first response (which will tell you that it is last in sequence) and then wait some more for the "real" responses, and see what they say.

    When you ask if you must parse the MQGET, you must at a minimum look at the MQCFH structure at the front, this is not really parsing, just do as you were doing before to access the MQCFH, and look at the compcode and reason in there. No need to look at the following parms for this particular comand.

    Cheers,
    Morag



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



  • 12.  RE: MQCMD_PING_CHANNEL

    Posted Wed April 13, 2022 10:29 AM
    Hi Morag,
        so you are saying that I need to issue MQGET   3  times right?   and the 2nd one will tell me the issue.

        It looks like it might be working now as I see retcode:00000002 rsncode:00000FAA .
        Please let me know your thought 

    Regards
    deb

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



  • 13.  RE: MQCMD_PING_CHANNEL

    Posted Wed April 13, 2022 06:15 PM

    You should issue MQGET until there are no more responses messages. In the case of a failed MQCMD_PING_CHANNEL, you will get three response messages.

    In the MQCFH structure at the beginning of the MQGET buffer, you should see an MQCFH_COMPCODE of 2 and an MQCFH_REASON of 4010. I assume that is what you are referring to when you say "retcode" and "rsncode". Hexadecimal 0x00000FAA is decimal 4010 which is MQRCCF_HOST_NOT_AVAILABLE

    Cheers,
    Morag



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



  • 14.  RE: MQCMD_PING_CHANNEL

    Posted Wed April 13, 2022 09:30 PM
    Thank you Morag.  I have one more question which is , I need wait on MQGET since channel commands are asynchronous. 
     But it would be a guess on wait parameter I can see. what is your thought ?

    Regards
    Deb

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



  • 15.  RE: MQCMD_PING_CHANNEL

    Posted Thu April 14, 2022 07:08 AM

    Look at the timestamps on your MQSC equivalent command. I suspect you will see that it all happens within a second. An MQGET with a wait interval of 5 seconds would seem appropriate. Remember that the Wait Interval is not measured in second but milliseconds.

    Cheers,
    Morag



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



  • 16.  RE: MQCMD_PING_CHANNEL

    Posted Thu April 14, 2022 09:35 AM
    thank you Morag. 


    regards
    deb

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



  • 17.  RE: MQCMD_PING_CHANNEL

    Posted Fri April 15, 2022 06:13 AM
    Hi Debabrata
    "I am trying to see if this command actually show me the real error as we encountered "
    What do you want to achieve?
    The "real error" can be a typo or timing issue.
    You ping a channel with the wrong spelling, or you ping a channel which does not exist yet but in 5 minutes time.
    The list of possible error messages is a bit incomplete.
    See Error codes applicable to all commands in
    https://www.ibm.com/docs/en/ibm-mq/9.2?topic=formats-how-pcf-definitions-are-shown
    It feels like SSL/TLS related issues are also not listed.

    ------------------------------
    Matthias Jungbauer
    ------------------------------