antibm-mqwebsphere-mq-fte

How to check Websphere MQ version in ant?


I am running a script in which I want to detect the WebSphere MQ Version and if this version is 7.1, then I want to run a runmqsc to set channel authentication. I do this:

   <if>
        <or>
            <os name ="AIX">
            <os name ="Linux">
        </or>
    <then>
        <loginfo>Checking the installed MQ version.</loginfo>
             <osexec commandbase="su" dir="/bin" mode="osexec">

            <args>
                  <arg value="-"/>
                          <arg value="- ${mq_admin_name}"/>
                          <arg value="-c"/>
                          <arg line="dspmqver | grep Version"/>

            </args>
             </osexec>

        <if>
             <not>
              <not>
               <contains casesensitive="yes" substring="7.1.0.0" string="${result.output}"/>
              </not>
             </not>
        <then>
           ...........
           ..........

After this I use a runmqsc. But the problem is the string {result.output} is empty. The dspmqver command is not getting executed properly..can someone suggest why?


Solution

  • There is a bit of a mismatch here between the title of the post, "How to check Websphere MQ version in ant?", the conclusion that dspmqver isn't being executed properly, and the lack of diagnostic information.

    My suggestion is as follows:

    1. Validate that osexec populates result.error. I just guessed that property would be populated given the existence of result.output. If osexec doe not populate it, use what it does populate with STDERR or modify it to do do something with STDERR if it does not already.
    2. Right below </osexec>, add <loginfo>Call to dspmqver returned: STDOUT='${result.output}', STDERR='${result.error}'</loginfo>
    3. If nothing is returned, drop the grep. The dspmqver command should return something to STDERR or STDOUT and the grep is filtering it out if it doesn't exactly match the search string.
    4. If nothing is still returned, challenge the assumption that dspmqver is even being executed. If it is, it either returns something or cuts an FDC file. Any other behavior would be a bug in dspmqver and not solvable through Ant or in response to this post.

    Basically, divide and conquer. Keep removing stuff until you get output. That will isolate the problem. Print useful diagnostics so once you isolate the problem you have some indication of what it is.