Abort a Job from Shell script called from After-Job Subrouti

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Abort a Job from Shell script called from After-Job Subrouti

Post by mac4rfree85 »

Hi Guys,

I have shell script which is currently returning return code of 3.

I am calling this script from my datastage job as a After-Job Subroutine. I expect the job to fail but the job is Finished(with Warning) status.

Can somebody help me as what i am doing wrong.

Cheers!!!!!
Mac4rfree
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Which after-job subroutine are you using?

Check out its source code, and learn how it handles the exit status of the executed command.

To have the job abort, the ErrorCode argument must be set to a non-zero value.

Make sure, too, that the after-job subroutine is actually being executed; for example is the "only execute if job successful" check box selected?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Post by mac4rfree85 »

The After Job-Subroutine which is present in the Job Properites. I am calling the script using the ExecSH option in the After-Job Subroutine
Mac4rfree
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

execSH will have a output and return code and unless the return code is anything other than 0 (say in case it is not able to execute the script) it will not be handled.

What you can do is to write a wrapper routine and Set the ErrorCode in based on the output value.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Post by mac4rfree85 »

hi priyadarshikunal, I am new to the routines. so could you help me out or point me to the right direction..
Cheers!!!
Mac4rfree
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You will find the source code for ExecSH in the Routines branch of the Repository. Use QuickFind to find it.
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