ESP Workload Automation

 View Only
  • 1.  Job showed CC=0 Success when it should have failed

    Posted 17 days ago

    Hello, we recently had an issue with a job trying to reach a network location. This job should have triggered a failure however the job showed CC=0 and completed successfully in ESP. I have reviewed the setup and can't see anything different from other jobs we have setup this way to execute bat files. Could someone help me to understand why the job did not fail even though there was an error connecting to a network location? Below you will see the spool files for the job in question. First one is from the day that should have showed a failure and the second is from a normal successful run.

    Daily should have failed

    ----------------------------------------------------------------

    Output of messages for workload object OSPMICR1/PRODMAIN.6104/MAIN

    Start date Thu Feb 01 10:48:51 2024

    ----------------------------------------------------------------

     D:\Program Files\CA\WA Agent>REM OSPMICR1.bat

     D:\Program Files\CA\WA Agent>REM @echo off

     D:\Program Files\CA\WA Agent>net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy Output\S3Bucket\Upload\DBDoneFiles"

     System error 1232 has occurred.

     The network location cannot be reached. For information about network troubleshooting, see Windows Help.

     D:\Program Files\CA\WA Agent>cd /d J: 

     The system cannot find the drive specified.

     D:\Program Files\CA\WA Agent>type nul  1>DailyDataHubDone.txt

     D:\Program Files\CA\WA Agent>REM Set Error Level in ESP

     D:\Program Files\CA\WA Agent>"D:\Program Files\CA\WA Agent\SetExitC" ERRORLEVEL

     ----------------------------------------------------------------
     Output of messages for workload object OSPMICR1/PRODMAIN.6109/MAIN
     Start date Tue Feb 06 06:09:29 2024
     ----------------------------------------------------------------
     D:\Program Files\CA\WA Agent>REM OSPMICR1.bat  
     D:\Program Files\CA\WA Agent>REM @echo off  
     D:\Program Files\CA\WA Agent>net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy Output\S3Bucket\Upload\DBDoneFiles" 
     The command completed successfully.
     D:\Program Files\CA\WA Agent>cd /d J: 
     J:\>type nul  1>DailyDataHubDone.txt  
     J:\>REM Set Error Level in ESP  
     J:\>"D:\Program Files\CA\WA Agent\SetExitC" ERRORLEVEL 
     



    ------------------------------
    [Keith Grizzell]
    [ESP Scheduler]
    [Grange Insurance]
    [Columbus] [Ohio]
    ------------------------------


  • 2.  RE: Job showed CC=0 Success when it should have failed

    Posted 17 days ago
    Edited by Rick Romanowski 17 days ago

    When your batch file exits it exits with the latest value of ERRORLEVEL

    If you update the batch file to check command status after attempting to connect to the network, you can save the result.

    Then at the end of the script use the variable ExitStatus

    Batch File Excerpt:

    net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy
    if %errorlevel% NEQ 0 set ExitStatus=%ERRORLEVEL%

    .

    .

    .

    SetExitC" %ExitStatus%


    To verify, run from a command prompt when the batch completes type:


    echo %ERRORLEVEL%


     



    ------------------------------
    Rick Romanowski
    rromanowski@ups.com
    Sr. Systems Analyst
    UPS
    NJ, USA
    ------------------------------



  • 3.  RE: Job showed CC=0 Success when it should have failed

    Posted 15 days ago

    Thank you Rick! That worked just as you suggested. Thanks for the help



    ------------------------------
    [Keith Grizzell]
    [ESP Scheduler]
    [Grange Insurance]
    [Columbus] [Ohio]
    ------------------------------



  • 4.  RE: Job showed CC=0 Success when it should have failed

    Broadcom Employee
    Posted 16 days ago

    I agree with Rick,
    In Windows, %ERRORLEVEL is reset after each command that is executed

    The fact that the NET USE command and the subsequent "cd" command had problems does not prevent the "type" command from executing.  You will need to separately detect that the NET USE command has failed and exit the script be fore even trying to do anything else.

    What will be happening in the example of your "failed" job is that the file will be created in "D:\Program Files\CA\WA Agent" - and this will succeed, hence %ERRORLEVEL being 0



    ------------------------------
    Thanks in advance
    Chris
    ------------------------------



  • 5.  RE: Job showed CC=0 Success when it should have failed

    Posted 15 days ago

    Thanks Chris! Your explanation helped me understand what was wrong with my original bat file



    ------------------------------
    [Keith Grizzell]
    [ESP Scheduler]
    [Grange Insurance]
    [Columbus] [Ohio]
    ------------------------------