2 Replies Latest reply on Nov 11, 2019 6:52 PM by Paul Robins

    How to get an output from a Mainframe job using the API?

    Felipe Locci
      Share This:

      Hello,

       

      Does anyone knows how to list a sysout from a Mianframe Job(JCL) using the  Control-m Automation/API?

      I've tried to do this and the message below has returned:

       

      LHGNQ=orderid

      ctm run job:output::get "controlm:LHGNQ"

      {

        "errors": [

          {

            "message": "job control:LHGNQ, rerun not found"

          }

        ]

       

      CLI syntax

      ctm run job:output::get

       

      ctm  -v

      9.18.2

       

       

      REST sysntax

      curl -H "Authorization: Bearer $token" "$endpoint/run/job/$jobId/output/?runNo=0"

        • 1. Re: How to get an output from a Mainframe job using the API?
          Adriano Gomes

          Hi Felipe Locci

           

          in order to successful get the job sysout from Z/os runs you will need to provide an USER that is allowed to perform the action on Z/os side, that means the user defined on the API Environment utilized to get the  initial Authentication token must map to an Existing Z/os Security system valid user. Our shop utilize a distinct user env for Z/os service calls.

           

          Once you have that, you need to provide the correct "controlm" name and valid active job order id.

          The correct CTM API service call is : ctm run job:output::get <jobId> [runNo]

           

          where <jobId> is "<controlm name>:<job order id>"

          "controlm name" is the name of the active gateway that connect to Z/Os Control-M.

          runNo: defalult is last run.

           

          I Hope You make it.

           

          A>Gomes

          • 2. Re: How to get an output from a Mainframe job using the API?
            Paul Robins

            Hi Felipe, it seems that for mainframe you need to specify the JES JOBID.

             

            In EM, when you look at the output history for a Windows job, the run number is sequential:

            When you look at a mainframe job output history it shows the JES JOBID:

            The only way I can think to work around this is to perform a job:log::get and parse the response to identify the JOBNAME/JOBID.

            I wonder if BMC would class this as a bug? As the job log clearly shows the RUN NUMBER=xxxxx details.

             

            Cheers,

            Paul.