I'm having issues with errors one some af my batchjobs. I'm currently running 50 batchjobs each day, with a log file, which tells me if the batchjob was completed successfully or not. The last week i've noticed some errors, and right now, I don't have any control which shows or just tells me if a batchjob fails with an error. My batchjobs are starting af script via sqlplus. I've tried use errorlevel, but id didn't Work.
My batchjob is looking like this so far. I've included the errorlevel code I tried to use.
@Echo Off
@For /F "tokens=1,2,3,4 delims=-/ " %%A in ('Date /t') do @(
Set Day=%%A
Set Month=%%B
Set Year=%%C
Set All=%%A-%%B-%%C
)
@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set Hour=%%A
Set Min=%%B
Set Sec=%%C
Set Allm=%%A.%%B.%%C
)
@For /F "tokens=3 delims=: " %%A in ('time /t ') do @(
Set AMPM=%%A
@Echo On
)
echo Start: %date% %time% >> ..\log\Scriptname_%All%_%Allm%.log
sqlplus "Script" >> ..\log\Scriptname_%All%_%Allm%.log
IF %errorlevel% NEQ 0 GOTO :Error
GOTO :Success
:error
echo There was an error.
echo Stop: %date% %time% >> ..\log\Scriptname_%All%_%Allm%.log
EXIT 1
:end
echo Success.
echo Stop: %date% %time% >> ..\log\Scriptname_%All%_%Allm%.log
EXIT 0