MQ

Expand all | Collapse all

cobol with the mqconnx api passing a user name and password..

  • 1.  cobol with the mqconnx api passing a user name and password..

    Posted Tue September 14, 2021 12:56 PM
    I am trying to connect to IBM MQ with the mqconnx api.  Before the user id and password needed to be validated by MQ, it was working perfectly.  I can see my pointers are being setup correctly but it still gives a 2035 error on connection..

    I am using acucobol.

    ------------------------------
    Christine Tod
    ------------------------------


  • 2.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Tue September 14, 2021 06:24 PM
    Edited by Morag Hughson Wed September 15, 2021 12:11 AM

    You should probably show us a snippet of your code so we can help you find the problem. However, first guess, did you set the MQCSP_AUTH_USER_ID_AND_PWD flag in the MQCSP structure?

    Also, you should probably show us what your error log has to say on the matter, AMQERR01.LOG on distributed platforms or the MSTR joblog on z/OS.

    Cheers,
    Morag



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



  • 3.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 01:09 AM
    thank you for your response.  I am very new at forums so thank you for your assistance.
    Below is my copy element for connecting.  It works perfectly on a queue that does not expect a user name and password.
    If I display my pointers I do have valid 32 bit values.  

    MQCONNX.


    SET CONFIGURATION "DLL-CONVENTION" TO "1".

    $ GET MQS-RECORD NOLOCK .

    MOVE MQCSP-AUTH-USER-ID-AND-PWD TO
    MQCSP-AUTHENTICATIONTYPE.


    MOVE MQCNO-VERSION-5 TO MQCNO-VERSION.



    SET MQCSP-CSPUSERIDPTR TO ADDRESS OF MQS-USER.

    SET MQCSP-CSPPASSWORDPTR TO ADDRESS OF MQS-PWD.



    MOVE 0 TO W-CHARS.

    INSPECT MQS-USER TALLYING W-CHARS
    FOR CHARACTERS BEFORE INITIAL SPACE .

    MOVE W-CHARS TO MQCSP-CSPUSERIDLENGTH .


    MOVE 0 TO W-CHARS.

    INSPECT MQS-PWD TALLYING W-CHARS
    FOR CHARACTERS BEFORE INITIAL SPACE.

    MOVE W-CHARS TO MQCSP-CSPPASSWORDLENGTH.

    SET MQCNO-SECURITYPARMSPTR TO ADDRESS OF SECOPTIONS.

    MOVE MQCC-OK TO COMPLETION-CODE.
    MOVE MQRC-NONE TO CON-REASON.


    CALL "MQCONNX" USING
    MQS-QM,
    BY REFERENCE CONNECTOPTS
    BY REFERENCE HCONN ,
    COMPLETION-CODE, CON-REASON
    ON EXCEPTION MOVE "Z001" TO ERR--PARAM
    MOVE "CONNECTION ERROR" TO ERR--EXTRA
    PERFORM ERR--HANDLER.



    IF COMPLETION-CODE IS EQUAL TO MQCC-FAILED
    MOVE CON-REASON TO W-RETURN
    STRING "MQCONNX ended with reason code "
    W-RETURN INTO W-TEXT
    PERFORM ERR-MSG
    GOBACK
    END-IF.

    MQCONNX-EXIT.
    EXIT.

    ------------------------------
    Christine Tod
    ------------------------------



  • 4.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 01:28 AM
    Edited by Morag Hughson Wed September 15, 2021 01:56 AM

    When you say "it works perfectly on a queue [manager] that does not expect a user name and password" do, you mean when nothing is checking the user ID and password at all? Or do you mean when the queue manager is configured to use CHCKCLNT(OPTIONAL) it works?

    Please can you show us what your <MQ_DATA_PATH>/qmgrs/<QM-name>/errors/AMQERR01.LOG says at the time of the failure please?

    Also could you share with us the output of the following two MQSC commands on your queue manager:

    DISPLAY QMGR CONNAUTH

    DISPLAY AUTHINFO(name-output-on-above-command) ALL

    Cheers,
    Morag



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



  • 5.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 01:54 AM

    Please can you show us what your <MQ_DATA_PATH>/qmgrs/<QM-name>/errors/AMQERR01.LOG says at the time of the failure please?   Would this be on the server or the client?  I only have limited access to the client side and nothing on the server - I would need to request this then..

    Also could you share with us the output of the following two MQSC commands on your queue manager:

    DISPLAY QMGR CONNAUTH

    DISPLAY AUTHINFO(name-output-on-above-command) ALL

    Where would I do this from or should I request from IT..




    ------------------------------
    Christine Tod
    ------------------------------



  • 6.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 02:00 AM

    Looks like you found the error log since you posted us an example (albeit a rather old example).

    If you don't have administrative access to the queue manager in question, then yes, you would need to ask someone who does, to run those commands. They can type them into the runmqsc tool, or other equivalent MQ admin tool.

    Cheers,
    Morag



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



  • 7.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 01:45 AM
    This is the error detail supplied by IBM admin user..


    ------------------------------
    Christine Tod
    ------------------------------



  • 8.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 01:56 AM

    One thing that error message immediately shows is that the queue manager does not believe that it has received a user id in the MQCSP block.

    Is 'flexapp' the user ID under which you are running the application? Can we assume this is a client connected application since we can see it is Program(amqrmppa) in your error message?

    Is this the most recent error you have for this problem? I ask because the date on the error message is over two weeks ago?

    While I am by no means a COBOL expert, the code you have shown looks correct from an MQ perspective, although I did wonder about this line:-

    SET MQCNO-SECURITYPARMSPTR TO ADDRESS OF SECOPTIONS.

    since I couldn't see in the snippet you have supplied, what SECOPTIONS was? It is named plausibly to be the MQCSP block.

    You've said that you have displayed your pointers and they appear to be valid 32bit values. Is that also true of the MQCNO-SECURITYPARMSPTR. Have you also checked that the lengths look valid?

    Cheers,
    Morag



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



  • 9.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 02:55 AM

    One thing that error message immediately shows is that the queue manager does not believe that it has received a user id in the MQCSP block.  – this seems be be the issue

    Is 'flexapp' the user ID under which you are running the application? Can we assume this is a client connected application since we can see it is Program(amqrmppa) in your error message?

    I am connecting from a client on a Linux machine.  Flexapp is the user name provided by IT(all lowercase).

    Is this the most recent error you have for this problem? I ask because the date on the error message is over two weeks ago?  I have been trying so many options with the same result..

    While I am by no means a COBOL expert, the code you have shown looks correct from an MQ perspective, although I did wonder about this line:-

    SET MQCNO-SECURITYPARMSPTR TO ADDRESS OF SECOPTIONS.
    SECOPTIONS is the 01 level for the MSCP record layout..
     
          * Connection options
           01 CONNECTOPTS.
               COPY CMQCNOV.CPY.
    *************MQCNO
     
     
          *  Security Options
           01 SECOPTIONS.
               COPY CMQCSPV.CPY.
    **********MQSP
     

    since I couldn't see in the snippet you have supplied, what SECOPTIONS was? It is named plausibly to be the MQCSP block.   These are displays of my pointers.  They do change each time I recompile my programs.

     
     
     
     
     

    You've said that you have displayed your pointers and they appear to be valid 32bit values. Is that also true of the MQCNO-SECURITYPARMSPTR. Have you also checked that the lengths look valid?

     

     

    Sent from Mail for Windows

     






  • 10.  RE: cobol with the mqconnx api passing a user name and password..

    Posted Wed September 15, 2021 03:10 AM

    You say, "Flexapp is the user name provided by IT(all lowercase)". Do you mean that it is the user ID you are putting into the MQCSP block, or do you mean that it is the user ID on your Linux box that is the MQ client in this situation, and under wh