Page 1 of 1

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

Posted: Wed Mar 27, 2013 12:47 am
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!!!!!

Posted: Wed Mar 27, 2013 1:22 am
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?

Posted: Wed Mar 27, 2013 1:47 am
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

Posted: Wed Mar 27, 2013 10:59 am
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.

Posted: Thu Mar 28, 2013 1:32 am
by mac4rfree85
hi priyadarshikunal, I am new to the routines. so could you help me out or point me to the right direction..
Cheers!!!

Posted: Thu Mar 28, 2013 3:43 am
by ray.wurlod
You will find the source code for ExecSH in the Routines branch of the Repository. Use QuickFind to find it.