Problem using commands for controlling Datastage Jobs

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
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

Problem using commands for controlling Datastage Jobs

Post 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''
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

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

Post by chulett »

Is there some particular reason that you're not using a Job Activity stage for this? :?
-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 »

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

"You can never have too many knives" -- Logan Nine Fingers
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

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

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

"You can never have too many knives" -- Logan Nine Fingers
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

Post by soportesis »

OK, Tnks a lot!!!
Post Reply