Page 1 of 1

Stop Datastage Job

Posted: Sat Aug 26, 2006 3:47 pm
by avi21st
Hi

I am designing the automation process of my project- In this process there is a Unix daemon process. All the time this Unix process would be running with 10 minute sleep. the process would trigger a shell which runs the datastage job using a dsjob -run.

Here I am implementing File watcher concept- If there is a new file in the SourceFile folder I would trigger a Datastage Job which would load the file to the respective table.

Now my question is I am executing the Unix daemon process from Datastage Job Sequencer as a execute activity. If I need to stop the process is kill -9 is enough or I need to stop the Datastage job.

If I need to stop the datastage job from as shell how to do that?
Thanks for your help

Posted: Sat Aug 26, 2006 8:41 pm
by kduke
Never ever kill with a -9. This can corrupt repository tables. use kill -15 or just kill. If you have a tightly wound loop then you may not be able to kill it.

I do not see an option to stop a job otherwise. You can do it from a routine. If you knew enough about BASIC then you could create a TCL command to do it.

Code: Select all

      RunHandle = DSAttachJob(JobName, DSJ.ERRNONE)
      JStat = DSStopJob(RunHandle)
      JStat = DSDetachJob(RunHandle)
These 3 API calls are what you need to create a BASIC routine to do it. To create a TCL command then you need to write a real BASIC program and CATALOG it. Do a search. I have talked about this before.

A more graceful way to shut this process down is to have it look for a file like STOPDSJOB. If it sees this file then it ends itself. You already have the logic to look for files. Use it.

Posted: Sun Aug 27, 2006 4:59 am
by ray.wurlod
Sage words. Heed them.

Posted: Sun Aug 27, 2006 5:14 am
by ArndW
If I remember correctly, you can only attach to using the API and then delete a running job if your process was the one that started it. I think I ran into that issue a while back, but I'll check when I get to a DS computer.

Posted: Sun Aug 27, 2006 7:47 am
by chulett
Seconding the sageness. Especially the build of an automated out request, something I always build into any process like this.