.cmd file zeke executes looks like:
call \\LMDSTAGE1MV.AAMHC.LOCAL\E$\Ascential\DataStage\Engine\bin\DSJOB -run -wait -param "param1=value1" -param "param2=value2" CF_WH_TEST CSS_ADDR_Control
IF %ERRORLEVEL% EQU 0 goto end
echo ============ >> e:\fail.txt
echo failed >> e:\fail.txt
echo %ERRORLEVEL% >> e:\fail.txt
goto done
:end
echo errorlevel didn't work >> e:\fail.txt
:done
EXIT %errorlevel%
Sequence is:
Job1 --Fail--> Notify ---> Stop
'
Job2 --Fail--> Stop
'
Notify
Sequence ends with Fatal error:
CSS_ADDR_Control..JobControl (fatal error from @Terminator_Activity_14): Sequence abort requested
but when it comes out of Zeke it shows as finished successfully.
Any help would be appreciated.
Thanks
Can Zeke detect a job aborted within a sequence?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Keep in mind the fact that, with that option, you'll never get a zero return code for a successful job run but instead it will return a 1. And a 2 if the job finishes with warnings, a 3 if aborted, etc etc. Not that that's a bad thing, just something that needed to be clarified.
No clue, however, if 'exit status' is the same as 'ERRORLEVEL' in the Windows batch world. I assume so but it's been way too long since I've had to worry about stuff like that.![Wink :wink:](./images/smilies/icon_wink.gif)
No clue, however, if 'exit status' is the same as 'ERRORLEVEL' in the Windows batch world. I assume so but it's been way too long since I've had to worry about stuff like that.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-jobstatus returns 1, 2, 3, etc. as expected. Now (at the risk of hijacking) I need to return a 0 to the scheduler if errorlevel is 1 or 2 and the errorlevel value if greater than 2.
Have tried several things, and this is close as close as I've come, but the results are unexpected.
IF ERRORLEVEL 1 SET ERRORLEV=0
ECHO Finished Successful >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
IF ERRORLEVEL 2 SET ERRORLEV=0
ECHO Finished with Warnings >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
IF ERRORLEVEL 3 SET ERRORLEV=3
ECHO Job Aborted >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
:done
EXIT %ERRORLEV%
--------------------
Logic is going into the first 'IF' but the value of ERRORLEVEL is 3???
ECHO displays:
Finished Successful
0
3
The status of the DataStage Sequence is 3
Thanks.
Have tried several things, and this is close as close as I've come, but the results are unexpected.
IF ERRORLEVEL 1 SET ERRORLEV=0
ECHO Finished Successful >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
IF ERRORLEVEL 2 SET ERRORLEV=0
ECHO Finished with Warnings >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
IF ERRORLEVEL 3 SET ERRORLEV=3
ECHO Job Aborted >> e:\fail.txt
ECHO %ERRORLEV% >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
GOTO done
:done
EXIT %ERRORLEV%
--------------------
Logic is going into the first 'IF' but the value of ERRORLEVEL is 3???
ECHO displays:
Finished Successful
0
3
The status of the DataStage Sequence is 3
Thanks.
This seems to work. While some of the status codes are for validation only, the objective here is that Zeke scheduler stops, operator notifies the programmer, and the programmer determines course of action. Anything other than 1 or 2 should generate a phone call.
Code:
IF ERRORLEVEL 99 GOTO Aborted
IF ERRORLEVEL 98 GOTO Aborted
IF ERRORLEVEL 97 GOTO Aborted
IF ERRORLEVEL 96 GOTO Aborted
IF ERRORLEVEL 21 GOTO Aborted
IF ERRORLEVEL 13 GOTO Aborted
IF ERRORLEVEL 12 GOTO Aborted
IF ERRORLEVEL 11 GOTO Aborted
IF ERRORLEVEL 3 GOTO Aborted
IF ERRORLEVEL 2 GOTO Warnings
IF ERRORLEVEL 1 GOTO Success
:Aborted
ECHO Job Aborted >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=8
GOTO done
:Warnings
ECHO Warnings >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=0
GOTO done
:Success
ECHO Success >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=0
:done
EXIT %ERRORLEVEL%
The IF's only worked in descending order.
Searches supplied a lot of the answers, Ray and Craig helped clear the mud out of my eyes.
Thanks.
Code:
IF ERRORLEVEL 99 GOTO Aborted
IF ERRORLEVEL 98 GOTO Aborted
IF ERRORLEVEL 97 GOTO Aborted
IF ERRORLEVEL 96 GOTO Aborted
IF ERRORLEVEL 21 GOTO Aborted
IF ERRORLEVEL 13 GOTO Aborted
IF ERRORLEVEL 12 GOTO Aborted
IF ERRORLEVEL 11 GOTO Aborted
IF ERRORLEVEL 3 GOTO Aborted
IF ERRORLEVEL 2 GOTO Warnings
IF ERRORLEVEL 1 GOTO Success
:Aborted
ECHO Job Aborted >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=8
GOTO done
:Warnings
ECHO Warnings >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=0
GOTO done
:Success
ECHO Success >> e:\fail.txt
ECHO %ERRORLEVEL% >> e:\fail.txt
SET ERRORLEVEL=0
:done
EXIT %ERRORLEVEL%
The IF's only worked in descending order.
Searches supplied a lot of the answers, Ray and Craig helped clear the mud out of my eyes.
Thanks.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: