Page 1 of 1

Problem using commands for controlling Datastage Jobs

Posted: Mon Mar 07, 2011 7:33 pm
by soportesis
Hello,

We've got a problem using commands for controlling Datastage Jobs. In a Sequence Job We are executing the following in a Execution Command stage called "Ec_EjecutaJob":

Code: Select all

dsjob -run -wait Md_ctrl_proys PruebaSoky_send
We want to catch that if the job that is being executed (PruebaSoky_send) fails, the Sequence job that executed the command fails too. The following logs show the detail of both executions. The first log represent the upper Sequence job, it returns the Status code = 0 meaning that the PruebaSoky_send job finished "OK" but it did not as we can see in log detail 2.

Log detail 1:
Prueba_Reset_job..JobControl (@Ec_ResetJob): Executed: dsjob -run -wait -mode RESET Md_ctrl_proys PruebaSoky_send
Reply=0
Output from command ====>
Waiting for job...
Finished waiting for job

Status code = 0

Log detail 2:
PruebaSoky_send..JobControl (fatal error from @Terminator_Activity_3): Sequence abort requested
Status code = 0
I don't know if there is a bug with this command or if i'm doing something wrong that i'm not aware of. Could you please help me? I'd appreciate any peace of advice you could provide.

Thanks in Advance,
Franky 22''

Posted: Mon Mar 07, 2011 8:17 pm
by ray.wurlod
You need the -jobstatus option, which causes the exit status of dsjob to be the exit status of the job itself (1 = OK, 2 = Warnings, 3 = aborted and so on). Use -jobstatus instead of -wait option.

Posted: Tue Mar 08, 2011 11:18 am
by soportesis
OK Ray, but what happend if I need to use the Automatically handle activities that fail option in my sequence?. If the Reply of a stage is distinct of zero, this option will interpret it like abort.

Posted: Tue Mar 08, 2011 12:34 pm
by chulett
Is there some particular reason that you're not using a Job Activity stage for this? :?

Posted: Tue Mar 08, 2011 12:36 pm
by chulett
soportesis wrote:OK Ray, but what happend if I need to use the Automatically handle activities that fail option in my sequence?. If the Reply of a stage is distinct of zero, this option will interpret it like abort.
That's true - left to its own devices it will interpret anything other than a zero status as some kind of failure. However, the documentation for the option shows you how to override that check - if it thinks you are handling the error then the "automatic" check won't kick in.

Posted: Thu Mar 10, 2011 9:19 am
by soportesis
Yes, I need to run a job that is not into my project. Or is there an other way to do this into a sequence job?

Posted: Thu Mar 10, 2011 10:03 am
by chulett
soportesis wrote:Yes, I need to run a job that is not into my project. Or is there an other way to do this into a sequence job?
No, that's how it needs to be done in that case.

Posted: Thu Mar 10, 2011 12:36 pm
by soportesis
OK, Tnks a lot!!!