CA Workload Automation ESP Edition

Expand all | Collapse all

Issue with batch files

  • 1.  Issue with batch files

    Posted 06-02-2015 04:28 AM

    Hello All,

     

    Greetings for the day.

     

    This is about windows batch files, my batch file will call couple of batch files internally, we have 2 conditions like error and success conditions, if nay batch files get fails, that should be go to error condition if all batch are doing well it will go to success conditions, but we got new requirement that is if few batch files fails it should not go to the error condition, those batch files will just go to exit to another condition(3rd condition ) could you please tell us how to use the condition to go to 3rd condition

     

    we have used below code please find that

     

    internally batch file code

     

    @Call :DispMsg "*========== %bProcNm% Successful Exit ==========" %DATE% %TIME%

    @dir \ > Nul 2>&1

    @goto ExitBat

     

    :Errexit

    @Call :DispMsg "*=*=*=*=*=*=* %bProcNm% ERROR EXIT !!! =*=*=*=*=*=*"

    @goto ExitBat

     

    :ExitBat

    @if not .%1 == .nopause pause

    @goto :EOF

     

    main batch file code

    @Call :DispMsg "*========== %bProcNm% Successful Exit ==========" %DATE% %TIME%

    @dir \ > Nul 2>&1

    @goto ExitBat

     

    :Errexit

     

    @Call :DispMsg "*=*=*=*=*=*=* %bProcNm% ERROR EXIT !!! =*=*=*=*=*=*"

    @xcopy xxxFFFxxxFFF > nul 2>&1

    @goto ExitBat

     

    :ExitBat

    @if not .%1 == .nopause pause

    @goto :EOF

     

     

    In above internal code will go to either error or success always and main program will follow the same accordingly.

     

    but here when the internal batch file code get error it should not use the error condition in the main batch file instead of this it should use new condition(3rd condition)----- this is my requirement

     

    could you please give your suggestions on this

     

     

    Thanks

    Nag 



  • 2.  Re: Issue with batch files

    Posted 06-02-2015 09:00 AM

    Nag,

     

    this is programming.. if you bat file calls other programs it has to check the error code then exit accordingly

    if that particular exit code is NOT to trigger a failure then you either need to use max_exit_success or success_codes attribute in your jil.



  • 3.  Re: Issue with batch files

    Posted 06-02-2015 09:55 AM

    "This is about windows batch files, my batch file will call couple of batch files internally,"

     

    Instead can you have a job for each of the internal batch files and eliminate the calls from the main batch file?

     

    Error coding is handled by job stream defined in Workload Automation Manager.

     

    Less programming and more visibility.

     

    What is type is your Workload Automation Manager?