Page 1 of 1

DOS command to abort a job

Posted: Fri Apr 25, 2008 12:07 am
by Rajee
Hi,

If the storedprocedure extracting data from the source tables returns no record, then I need to abort the job.
I guess it can be done in the after job routine by calling some batch file.If so,can anyone let me know the DOS command through which i can abort the job.

Thx,
Rajee

Posted: Fri Apr 25, 2008 12:15 am
by bkumar103
I dont understand how are you going to abort the job from the after job routine. One way you can achive it using the sequence job. In the sequence job first check that data is present in table. If it returns data then trigger the job using job activity stage otherwise stop the job.

Posted: Fri Apr 25, 2008 12:19 am
by ray.wurlod
Setting the second argument (ErrorCode) of an after-job routine will abort the job. If you are using ExecSH or ExecDOS it should be sufficient to execute a command that will fail, for example mr mxyzpltk

Posted: Sun Apr 27, 2008 9:57 pm
by Rajee
ray.wurlod wrote:Setting the second argument (ErrorCode) of an after-job routine will abort the job. If you are using ExecSH or ExecDOS it should be sufficient to execute a command that will fail, for example mr ...


Ray I am not able to have a complete view of your reply,hence still no clue about implementing the above functionality.......

Posted: Sun Apr 27, 2008 10:30 pm
by ray.wurlod
Premium membership is inexpensive, at less than 30c (Rs12) per day. if you had premium membership you would be able to read my entire reply, and get other benefits as well.

All revenue from premium membership is devoted to defraying hosting and bandwidth costs incurred by DSXchange. So, by taking premium membership, you additionally benefit by ensuring that DSXchange will be there to answer your questions in future.

Posted: Tue Apr 29, 2008 12:20 am
by Rajee
Rajee wrote:
ray.wurlod wrote:Setting the second argument (ErrorCode) of an after-job routine will abort the job. If you are using ExecSH or ExecDOS it should be sufficient to execute a command that will fail, for example mr ...


Ray I am not able to have a complete view of your reply,hence still no clue about implementing the above functionality.......


Ray,I cannot use any after-job routine to abort the job as I am using ExecDOS in the after-job subroutine to call a batch file.Also,i need to check for if a particular file is empty and only then abort the job.

Posted: Tue Apr 29, 2008 12:31 am
by ray.wurlod
Of course you can. You can execute a pipeline through ExecDOS (for example command1 ; command2) or you can create your own after-job subroutine that invokes the batch file and tests for the empty file.

I still prefer never to abort jobs.

Posted: Tue Apr 29, 2008 4:29 am
by Rajee
ray.wurlod wrote:Of course you can. You can execute a pipeline through ExecDOS (for example command1 ; command2) or you can create your own after-job subroutine that invokes the batch file and tests for ...

Ray,as Iam not able to view your response fully I am not able to understand your logic/solution fully and implement it.If getting the premium membership is the ony way to view your response fully then I am unfortunate as of now.

Posted: Tue Apr 29, 2008 4:57 am
by ArndW
Rajee - the important part of Ray's post is visible to you.

Posted: Tue Apr 29, 2008 11:05 pm
by Rajee
ArndW wrote:Rajee - the important part of Ray's post is visible to you. ...
ArndW,as per Rays logic,
1.I need to invoke the batch file through the after-job subroutine and check for the file with 0 byte and abort the job.

My queries with respect to Ray's response are,
1.How to invoke a batch file through after-job subroutine?
2.How to pass the batch file parameters if I invoke the batch file through after-job subroutine?
3.I know only a DOS command to check for the existance of 0 byte file,in such case can i call the Datastage subroutine through the DOS command that i use to check for the 0 byte file in the batch file to abort the job.

Posted: Tue Apr 29, 2008 11:53 pm
by ray.wurlod
Search in on-line help for DSExecute subroutine.