Original Message:
Sent: Oct 09, 2024 09:40 AM
From: Rick Romanowski
Subject: Job showed CC=0 Success when it should have failed
Lucy is correct that Rick has retired, but Broadcom has allowed me to still have access to Broadcom Communities. :)
I tested the Updated Bat file on a Windows PC and when I run it the NET USE command fails since I have no access to what is specified in the command.
Test Bat File
@echo off
net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy Output\S3Bucket\Upload\DBDoneFiles"
cd /d J:
if %errorlevel% NEQ 0 set ExitStatus=%ERRORLEVEL%
echo type nul >DailyDataHubDone.txt
echo Exitstatus:%ExitStatus%
REM Set Error Level in ESP
:DONE
Exit /B %ExitStatus%
Instead on commenting out @ECHO OFF, I added a ECHO statement to display the value of variable ExitStatus.
I replaced the Broadcom SetExitC with the Windows native EXIT command (Windows system has no ESP Agent)
After running the Bat File, the ERRORLEVEL is checked in the Command Window:
Test.bat
System error 53 has occurred.
The network path was not found.
The system cannot find the drive specified.
Exitstatus:1
echo %errorlevel%
1
My suggestion is for you to run this on your Test/Dev system and update the NET USE statement with incorrect information to cause the NET USE command to fail, this will allow you to test that the code functions as you need.
Original Message:
Sent: Oct 07, 2024 10:52 AM
From: Keith Grizzell
Subject: Job showed CC=0 Success when it should have failed
Hi Rick, we worked on this back in February and I thought I had it figured out. Turns out I was just lucky we didn't get the connection error until this past Friday so I thought it was working. Can you confirm the suggested edits to the bat file below? Bold in proposed is what I am looking to confirm
************* Original Daily Bat File *****************
REM OSPMICR1.bat
REM @echo off
net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy Output\S3Bucket\Upload\DBDoneFiles"
cd /d J:
type nul >DailyDataHubDone.txt
REM Set Error Level in ESP
:DONE
"%ESPAGENTDIR%\SetExitC" %ERRORLEVEL
************ Proposed new daily bat file **********************
REM OSPMICR1.bat
REM @echo off
net use J: "\\gmcc.grange.local\Y\GRP2\Business Intelligence\MicroStrategy Output\S3Bucket\Upload\DBDoneFiles"
cd /d J:
if %errorlevel% NEQ 0 set ExitStatus=%ERRORLEVEL%
type nul >DailyDataHubDone.txt
REM Set Error Level in ESP
:DONE
"%ESPAGENTDIR%\SetExitC" %ExitStatus%
------------------------------
[Keith Grizzell]
[ESP Scheduler]
[Grange Insurance]
[Columbus] [Ohio]
Original Message:
Sent: Feb 06, 2024 10:57 AM
From: Rick Romanowski
Subject: Job showed CC=0 Success when it should have failed
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
Original Message:
Sent: Feb 06, 2024 10:33 AM
From: Keith Grizzell
Subject: Job showed CC=0 Success when it should have failed
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]
------------------------------