Page 1 of 1

Conditional job abort

Posted: Fri May 11, 2007 4:50 pm
by videsh77
Hi

In my Px job, after some condition in transformer is evaluated false, I want that DataStage job to abort. It should not execute further stages. Can someone suggest me what is the way out of this?

Thanks in advance.

Re: Conditional job abort

Posted: Fri May 11, 2007 5:51 pm
by sud
videsh77 wrote:Hi

In my Px job, after some condition in transformer is evaluated false, I want that DataStage job to abort. It should not execute further stages. Can someone suggest me what is the way out of this?

Thanks in advance.
Break your job into two jobs. First job sets the job status conditionally and according to the condition the second job is triggered. If you don't want to break up your job, you will have to use a basic transformer stage and call a basic routine which will abort the job.

Posted: Mon May 14, 2007 1:46 am
by thompsonp
You can force a job to abort in a transformer by setting the 'Abort After Rows' field for a link on the constraints page. In your case add a link if you don't already have one with a constraint that is the condition you want to catch.

I don't think it is very good practice to force a job to abort and I have seen cases where this functionality does not abort the job because the signal is not detected before the job finishes. Can you achieve the desired outcome by checking the status of the job after it finsihes and counting the number of rows going down particular links?

Posted: Tue May 15, 2007 8:01 am
by Nageshsunkoji
We Can achieve your requirement by writing the Basic Routine and call that in After Subroutine box.

First thing is make the constraint as per your requirement in a new link called dummy link ( Condition is data='False') in that link just create a column called Dummy and direct to Copy stage and leave as it is. If your constrained satisfied with your input data then rows will go to the dummy link.

In the Basic routine use DSGetLinkInfo to get row count and write conditon that if that particular link have the rows more than 0 then abort the job and u can create Abort message also in your job by using DSLogFatal.

Hope it will be helpful......

Posted: Tue May 15, 2007 8:10 am
by DSguru2B
The easiest method, without much custom coding, is thompsonp's method. This way will cause and immediate abort and prevent further stages to execute.

Posted: Thu May 17, 2007 6:27 am
by videsh77
Yes, I used thomsomps method.

I set, 'Abort after rows = 1', for failure condition. It aborts the job.

Thanks.