How to abort a job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

How to abort a job

Post 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
Vijay
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

Post 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
Vijay
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

Post by vijaydev »

we dotn have any dstransform or commands to do this from job..
Vijay
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

Post 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...
Vijay
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vijaydev
Participant
Posts: 54
Joined: Sun May 20, 2007 6:31 pm

Post by vijaydev »

Thank You "chulett"
Vijay
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Glad I could help, "vijaydev". :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply