How to use the exception handler

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

How to use the exception handler

Post by tanaya.deshpande@tieto.co »

I want to use exception handler in a sequence in such a way that sequence should run three times in case it aborts and after 3rd time it should stop

I have checked the two options
add checkpoints so the sequence is restartable ..
Automaticaly handle activities that fail..
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

As an initial step try with below logic.

Maintain counter variable and for each abort increment the counter variable by 1 when it meets counter value 3 then stop the sequence using Terminator activity.

Exception handler --> Nested Condition --> Teminator Activity.
Cheers
Ravi K
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: How to use the exception handler

Post by chulett »

tanaya.deshpande@tieto.co wrote:sequence should run three times in case it aborts and after 3rd time it should stop
Can't be done with any stage inside the sequence. That's something your external job control will need to handle.
-craig

"You can never have too many knives" -- Logan Nine Fingers
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

May be I have explained it incorrectly I will try it again ..

I want to use exception handler in such a way that
sequence should run three times in case it aborts and after 3rd time it should stop
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Saying the exact same thing again doesn't go a long way towards changing our understanding. And my same answer still applies. If the Sequence aborts, it is dead so nothing inside the Sequence will help rerun it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Now... if you actually mean you want to try running a Job Activity three times in case the job (not the Sequence) aborts, that is perfectly feasible. Still won't need an Exception Handler for that, the Start/End Loop stages will get you what you need.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Yep, we could exclude Exception Hanlder. When counter meets 3 then redirect to Teminator Activity to stop Sequence.
Cheers
Ravi K
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

can you please give its design ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Have you used the Loop stages before? This would be a pretty simple design - run the job inside the Loop stages, tell it to loop three times and use triggers to check the job's completion status to decide what to do each iteration.

Job ran ok? Exit the loop 'early' by branching to a stage after the End Loop stage. Use a Sequencer for a 'do nothing' stage if that's appropriate.

Job aborted? Continue the loop.

Job aborted for the 3rd time? The loop will automatically end at that point, branch from the End Loop stage to whatever stage would be appropriate in that case. As noted, perhaps a Terminator if you want to abort the Sequence in that case.
-craig

"You can never have too many knives" -- Logan Nine Fingers
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

Thanks Chulett for your reply..I still have one doubt

Here are the steps the sequence will run..

1) If Job activity success (don't enter the loop) exit loop..
2) if the job activity fails ..enter loop
iteration 1:
if Job activity success ..exit loop
3) If job activity fails now ...enter loop
now will the iteration be 2nd or again the first iteration will start????

I am asking u this question because I am not able to test what I am doubting
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

2) and 3) are not 'enter loop', it is continue loop as you only enter it once... and yes, the counter / iteration will automatically increment each time you take another lap around the loop.
-craig

"You can never have too many knives" -- Logan Nine Fingers
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

Thanks a lot Ravi and Chulett my problem is solved... :D
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

I was succesful in executing that code when there was one job activity

I joined start and endloop to the activity and in the trigger of that activity I gave condition failed ...

But now if I have more than 1 job activity and I want to run the loop when any of the activity fails then how to do it ???
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post by tanaya.deshpande@tieto.co »

Is there any activity to forcefully stop the sequence
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

tanaya.deshpande@tieto.co wrote:But now if I have more than 1 job activity and I want to run the loop when any of the activity fails then how to do it ???
You certain you want to do that - rerun all of them if any one of them fails? If so, seems to me it would be custom triggers checking all results and deciding where to go, out or back around. Probably in a Nested Condition stage.
-craig

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