Page 1 of 1

How to Abort the job based on some logic?

Posted: Wed Feb 14, 2007 2:20 am
by sasikiran
Hi All,

I have a senario,

- I have to check one folder for given file name(Ex:emp.txt), if file exists then ok else i want to abort the job.

- I am using folder stage to verify whether files is exists or not

- I don't know how to abort the job if file is not found. :?


please help me out.

Thanks for reply

Sas

Posted: Wed Feb 14, 2007 2:26 am
by ray.wurlod
Don't do it that way at all.

Use a Wait For File activity in a job sequence. You can have one output from this when the file exists (or comes into existence within the required time period) that then executes your job. You have another output that is taken when the timeout expires without the file appearing. This does not execute your job at all.

By this means there's no need to abort anything; you retain complete control. Please refer to my recent Best Practices post for more.

Posted: Wed Feb 14, 2007 5:20 am
by sasikiran
Hi Ray,

My Requirment is

- If file is found then I have to move further and populate staging table.

- If file is not found then I have abort the job and I have to send a mail saying that required file is not there.

how can i do that?.

Thnaks & Regards
Sas

Posted: Wed Feb 14, 2007 6:01 am
by saikir
Hi,

I am not totally clear of your requirement. However, if you want abort a job you can use UtilityAbortToLog. You can find more information in the datastage documentation by searchin with the keyword Utility Transforms

Sai

Posted: Wed Feb 14, 2007 8:00 am
by chulett
sasikiran wrote:- If file is not found then I have abort the job and I have to send a mail saying that required file is not there.
Just run the job. If the file isn't there, the job will abort without you having to do anything. To send an email in that case, you'll need to use a Sequence job to run the job and trigger an email in the event of a failure.

If you want something more graceful, use a WaitForFile stage to check for the existence of the file first. Set the wait time to 0 to get an existence check. Then you can send a specific email when the file isn't found rather than assuming the abort is for that reason. File found, run the job.

Posted: Wed Feb 14, 2007 8:09 am
by DSguru2B
chulett wrote: Just run the job. If the file isn't there, the job will abort without you having to do anything.
There you go, its as simple as that :lol:
Dont abort the job, end it gracefully as others have noted.

Posted: Wed Feb 14, 2007 8:10 am
by sasikiran
Hi Craig,

I think this is much better option, thanks for quick responce.

Thnaks & Regards
Sas

Posted: Wed Feb 14, 2007 2:25 pm
by ray.wurlod
What is this fascination that people have developed with having jobs abort? Never design to abort, say I.

Posted: Wed Feb 14, 2007 2:47 pm
by DSguru2B
Me thinks the same :wink:

Posted: Wed Feb 14, 2007 3:23 pm
by chulett
Other than for Restartable Sequence jobs, I'm right there with ya. :wink: