4 Replies Latest reply on Oct 10, 2019 4:28 AM by Poonam Thorat

    Batch Script to trigger IICS Taskflows using RunAJobCli

    Poonam Thorat New Member

      We are using Third party scheduler to schedule IICS taskflows/MCTs. For that, batch script is written which will execute RunAJobCli command to trigger taskflow. But the issue is after taskflow gets completed, the exit code is not being captured in batch script. Due to which, even if job fails , third party scheduler will mark it as completed/succeeded job.Any help is appreciated. Thanks!

        • 1. Re: Batch Script to trigger IICS Taskflows using RunAJobCli
          Ashwini Ramakrishna New Member

          Hello Poonam,

           

          RunAJobCli utility returns status code after execution of the command. In the script set the status code based on the below table and you can mark your job in third party tool based on the return code.

          Job_Status_Code

          • 2. Re: Batch Script to trigger IICS Taskflows using RunAJobCli
            Poonam Thorat New Member

            Hi Ashwini,

             

            Thanks for the reply. The problem is not with runajobcli. The issue is with batch script. To give you the clear picture, i am executing below commands

             

            "D:\Program Files\Informatica Cloud Secure Agent\downloads\package-runAJobCli.10\package\cli.bat" runAJobCli -u XXX -p XXX -fp %1 -n %2 -t %3 >NUL

            echo Exit code is %errorlevel%

             

            set return_code=%errorlevel%

            IF %return_code% == 0 (Echo Success goto End1)

            IF %return_code% == 1 (ECHO Warning! %2 Completed with Warnings .Please check goto End1) ELSE (Echo Alert! %2 Failed. Please check. exit /b %return_code% goto End1)

             

            In the above code, exit code is not getting captured in errorlevel variable. Due to which, even if job fails in IICS monitor, the failed status is not being reflected in third party scheduler.

            • 3. Re: Batch Script to trigger IICS Taskflows using RunAJobCli
              Mallikarjuna Reddy Seasoned Veteran

              The problem is with the output redirection that you are doing using " >NUL ". Doing so, the cli.bat will not be able to set the errorlevel.

               

              Try Below:

              D:\Program Files\Informatica Cloud Secure Agent\downloads\package-runAJobCli.10\package\cli.bat" runAJobCli -u XXX -p XXX -fp %1 -n %2 -t %3

              echo Exit code is %errorlevel%

               

              set return_code=%errorlevel%

              IF %return_code% == 0 (Echo Success goto End1)

              IF %return_code% == 1 (ECHO Warning! %2 Completed with Warnings .Please check goto End1) ELSE (Echo Alert! %2 Failed. Please check. exit /b %return_code% goto End1)

              • 4. Re: Batch Script to trigger IICS Taskflows using RunAJobCli
                Poonam Thorat New Member

                Removing the redirection >NUL also doesnt help. I have tried that as well

                Also, even if errorlevel is not set, the control should atleast go in else block and print the message but even that is not working.