Can Zeke detect a job aborted within a sequence?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Can Zeke detect a job aborted within a sequence?

Post by danddmrs »

.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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How is Zeke detecting the job status?

Change -wait to -jobstatus then the exit status of dsjob should be the same as that of the job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

Thanks for the responses, cannot change the .cmd from home but will give it a go in the a.m.

Ray - I found the DataStage Basic and Server to Parallel DVD classes very helpful. Thanks for doing those.
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

-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.
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

11 isn't aborted - it is "validation succeeded". Similarly 12 should go to Warnings.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... like I said, been waaaay too long since I've done anything at the DOS level but now that you say it I do recall you need to check ERRORLEVEL in descending order. :)
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply