Sequencer job status when command activity fails

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Sequencer job status when command activity fails

Post by bobyon »

dsjob is returning 0 even when command activity fails.

I am working on a script that calls dsjob to submit a DS sequencer. The Sequencer contains job activities and command activities. The script is looking for the return code coming from the dsjob command expecting a non-zero value if anything fails. I have tried both the -wait and the -jobstatus options. The job returns a 1 when the job called by the job activity fails but if a command activity fails, it still returns a 0.

How do I get a non-zero return code from the sequencer when a command activity fails?
Bob
mail2hfz
Premium Member
Premium Member
Posts: 92
Joined: Thu Nov 16, 2006 8:51 am

Post by mail2hfz »

What activity is being performed in your command activity stage?
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Post by bobyon »

the command activity is an execution of a script that does an scp command to move data from one server to another.
Bob
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need the Sequence itself to fail or at least log a warning when there are issues with the processes it runs and there are many ways to accomplish that. There are compiler options in the Job Properties tab, for instance, or the Terminator stage to name a couple of things.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Post by bobyon »

actually to be a bit more precise, the command is a sudo command to execute a script.

In director I see the following:

Code: Select all

RMKD400W..JobControl (@TRANSFER2MAINFRAME): Command sudo did not finish OK, reply = '1'
RMKD400W..JobControl (@Coordinator): Summary of sequence run
12:13:02: Sequence started (checkpointing on)
12:13:02: P_RMK_SVOC_GetEmailInfo (JOB P_RMK_SVOC_GetEmailInfo) started
12:13:03: P_RMK_SVOC_GetPhoneInfo (JOB P_RMK_SVOC_GetPhoneInfo) started
12:16:14: P_RMK_SVOC_GetPhoneInfo (JOB P_RMK_SVOC_GetPhoneInfo) finished, status=1 [Finished OK]
12:19:15: P_RMK_SVOC_GetEmailInfo (JOB P_RMK_SVOC_GetEmailInfo) finished, status=1 [Finished OK]
12:19:15: TRANSFER2MAINFRAME (COMMAND sudo) started
12:19:15: TRANSFER2MAINFRAME finished, reply=1
12:19:15: Terminator_Activity Executed
12:19:15: Sequence terminated
RMKD400W..JobControl (fatal error from @Terminator_Activity): RMK0428D: SVoC - TD Sync Aborted
Attempting to Cleanup after ABORT raised in job RMKD400W..JobControl
Job RMKD400W aborted.
Bob
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In a way, that doesn't really matter. The Sequence ran the process and that was all it was tasked to do and it was able to do it. The same could apply to Job Activities or any other stage in the Sequence... unless the Sequence itself has a problem, it's going to report back that it ran just fine.

So, from your log you have a Terminator in the stream somewhere? What settings do you have there and what is the actual status of the Sequence job when the dust settles? Something other than 'Finished OK'?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Post by bobyon »

Terminator is set to abort without sending stop request.

And, as you can see from the log excerpt, the Sequence RMKD400W has aborted. Yet dsjob, even when submitted manually from the command line, still reports status code = 0
Bob
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Post by bobyon »

we switched from -wait back to -jobstatus and the status code is now being set to 3.

Which is correct.

But I thought, -wait should return non-zero return codes also.
Bob
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It should, as long as you use one or the other. The -jobstatus option gives you 1,2,3 (etc) which match the internal numbers DataStage uses whereas the -wait should be zero or some kind of non-zero return as you've noted. If that's not happening, it may be an 8.x issue and one you should raise with your official support provider. IMHO.
-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 »

dsjob -run returns its own exit status; if the job request was made successfully then the correct exit status for dsjob is 0.

However, the -jobstatus option has a side effect of causing dsjob -run to exit with the exit status of the job itself.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As does -wait, it's just that the status returned is more... traditional. Agreed, however, that without either it's all about if it was able to start the job or not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply