Page 1 of 1

How to abort a job

Posted: Wed Jul 18, 2007 11:29 pm
by vijaydev
Hi

i am executing one batfile if the batfile failed i need to abort my job i am able get the status of that batfile "F" or "P". i want to abort my job if it is "F"

Help me, Thanks in Advance


Vijay

Posted: Wed Jul 18, 2007 11:36 pm
by chulett
Where are you running this 'bat file'? Typically, you'd just need to ensure the batch returned a zero return status when everything went well and a non-zero return status when there was a problem.

Posted: Wed Jul 18, 2007 11:38 pm
by chulett
... or you could specifically check for the 'F' versus 'P' and branch a Sequence job off to a Terminator stage when it sees 'F'.

Posted: Wed Jul 18, 2007 11:44 pm
by vijaydev
i am getting the status F or P in stage varibale this is ok.
My probelm is i want to abort the job if the status of stage varibale is F.

Vijay

Posted: Wed Jul 18, 2007 11:54 pm
by vijaydev
we dotn have any dstransform or commands to do this from job..

Posted: Thu Jul 19, 2007 12:03 am
by chulett
Again - where exactly are you calling this batch file? And if you want to abort based on a stage variable, you can do that in another one. For example, something like this

Code: Select all

svBatCheck: If svBatStatus = 'F' then DSLogFatal('Kaboom') Else svBatCheck
Or something similar.

Posted: Thu Jul 19, 2007 12:06 am
by vijaydev
i am calling this batfile in a routine using "Call DSExecute("DOS","E:\DATAFILES\SOURCE\TBillTrxn_Batch.bat",Output,SystemReturnCode)"

This status i am taking in a stage varibale...

Posted: Thu Jul 19, 2007 12:15 am
by chulett
So, inside the job once for every record processed? :? Regardless...

You could 'abort the job' from inside your routine if you liked, or take the code sample I posted and run with it. In either case, abort by writing a Fatal log message.

Posted: Thu Jul 19, 2007 1:15 am
by vijaydev
Thank You "chulett"

Posted: Thu Jul 19, 2007 6:47 am
by chulett
Glad I could help, "vijaydev". :wink:

Posted: Thu Jul 19, 2007 3:01 pm
by ray.wurlod
Let me get this right in my head. For every row processed you are:
  • deriving a stage variable

    invoking a routine

    invoking a DOS shell

    executing a BAT file

    recovering its exit status

    making a decision about aborting based on a constraint expression [Reject]
Don't you think there might be too many layers of software here? What's the BAT file doing that couldn't be done in the stage variable expression or, perhaps, in the routine?
:roll:

Doubtless you'll be back soon seeking ways to improve the performance.