Unix Return Code

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
msacks
Premium Member
Premium Member
Posts: 24
Joined: Wed Apr 09, 2008 7:22 am

Unix Return Code

Post by msacks »

Hi-

I tried searching for an answer here for this without luck. I'm still new to DataStage so please bear with me.

I have a DataStage Sequence I'm trying to get to work. The first stage in the sequence is an Execute Command stage (named Execute_Command_0). This stage executes a shell script on the UNIX server, which will set a return code to eiher zero or one. The Execute Command stage has two triggers, the first has Expression Type "OK - Conditional", the other has "Custom - Conditional". The problem is with the "Custom - Conditional". I have the expression in the trigger for this as follows:

Execute_Command_0.$ReturnValue = '1'

When I execute the job it aborts with the error messages below. But since I'm explicitly testing for this return code I'm not sure why DataStage is treating this as an Unhandled Failure. I also tried changing the Expression Type for the trigger to ReturnCode - Conditional, and setting the Expression to 1, but that also didn't work. I also tried changing the Expression to '1' and "1" which also didn't work.


In Director I see the following Warnings:

WARNING
checkWeekTest..JobControl (@Execute_Command_0): Command /sbin/sh /home/dsadm/scripts/checkWeek.sh did not finish OK, reply = '1'

WARNING
checkWeekTest..JobControl (@Execute_Command_0): Controller problem: Unhandled failure (1) encountered executing command /sbin/sh /home/dsadm/scripts/checkWeek.sh

INFO
checkWeekTest..JobControl (@Coordinator): Summary of sequence run
14:27:14: Sequence started (checkpointing on)
14:27:14: Execute_Command_0 (COMMAND /sbin/sh /home/dsadm/scripts/checkWeek.sh) started
14:27:15: Execute_Command_0 finished, reply=1
14:27:15: Exception raised: @Execute_Command_0, Unhandled failure (1) encountered executing command /sbin/sh /home/dsadm/scripts/checkWeek.sh
14:27:15: Sequence failed (restartable)

FATAL
checkWeekTest..JobControl (fatal error from @Coordinator): Sequence job (restartable) will abort due to previous unrecoverable errors


Any help would be greatly appreciated!!
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: Unix Return Code

Post by priyadarshikunal »

msacks wrote:Hi-

I tried searching for an answer here for this without luck. I'm still new to DataStage so please bear with me.

I have a DataStage Sequence I'm trying to get to work. The first stage in the sequence is an Execute Command stage (named Execute_Command_0). This stage executes a shell script on the UNIX server, which will set a return code to eiher zero or one. The Execute Command stage has two triggers, the first has Expression Type "OK - Conditional", the other has "Custom - Conditional". The problem is with the "Custom - Conditional". I have the expression in the trigger for this as follows:

Execute_Command_0.$ReturnValue = '1'

When I execute the job it aborts with the error messages below. But since I'm explicitly testing for this return code I'm not sure why DataStage is treating this as an Unhandled Failure. I also tried changing the Expression Type for the trigger to ReturnCode - Conditional, and setting the Expression to 1, but that also didn't work. I also tried changing the Expression to '1' and "1" which also didn't work.


In Director I see the following Warnings:

WARNING
checkWeekTest..JobControl (@Execute_Command_0): Command /sbin/sh /home/dsadm/scripts/checkWeek.sh did not finish OK, reply = '1'

WARNING
checkWeekTest..JobControl (@Execute_Command_0): Controller problem: Unhandled failure (1) encountered executing command /sbin/sh /home/dsadm/scripts/checkWeek.sh

INFO
checkWeekTest..JobControl (@Coordinator): Summary of sequence run
14:27:14: Sequence started (checkpointing on)
14:27:14: Execute_Command_0 (COMMAND /sbin/sh /home/dsadm/scripts/checkWeek.sh) started
14:27:15: Execute_Command_0 finished, reply=1
14:27:15: Exception raised: @Execute_Command_0, Unhandled failure (1) encountered executing command /sbin/sh /home/dsadm/scripts/checkWeek.sh
14:27:15: Sequence failed (restartable)

FATAL
checkWeekTest..JobControl (fatal error from @Coordinator): Sequence job (restartable) will abort due to previous unrecoverable errors


Any help would be greatly appreciated!!

Here for any stage if returns anything else than 0 then it is a error for datastage.

Since your execute command stage is returning 1 means it failed to execute.

Can you run it with a true condition so that it returns 0

if it runs then try not to get the value you are getting from 'Return Value'

try getting it from 'command output' option.

then don't forget to parse it correctly.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
msacks
Premium Member
Premium Member
Posts: 24
Joined: Wed Apr 09, 2008 7:22 am

Post by msacks »

Thanks for the response. I already know that if the shell script exits with return code zero the sequence will not abort. DataStage allows me to create a trigger and create my own custom Exception handling, so it should be able to handle a return code other than zero and let me programatically deal with it. Any one else out there have any thoughts on this?
filename.txt
Participant
Posts: 27
Joined: Thu Mar 20, 2008 11:55 am

Post by filename.txt »

Please try using option

Triggers > Expression Type > ReturnValue-(conditional)=1

instead of using custom-(conditional)
Thanks.

"Creativity is the ability to use your available resources to their fullest."
filename.txt
Participant
Posts: 27
Joined: Thu Mar 20, 2008 11:55 am

Post by filename.txt »

Please try using option

Triggers > Expression Type > ReturnValue-(conditional)=1

instead of using custom-(conditional)
Thanks.

"Creativity is the ability to use your available resources to their fullest."
msacks
Premium Member
Premium Member
Posts: 24
Joined: Wed Apr 09, 2008 7:22 am

Post by msacks »

Hi, please re-read my original post, I've already tried this.
filename.txt
Participant
Posts: 27
Joined: Thu Mar 20, 2008 11:55 am

Post by filename.txt »

msacks wrote:Hi, please re-read my original post, I've already tried this.
Did you give
returnvalue(conditional)=1
or ='1'
or = "1" ?
I tried with returnvalue(conditional)=1...without quotes and it works fine.


did you check your script file..
in error I see /sbin/sh
your script should start with #!/bin/sh without spaces

Please do try to Run your script from command line.
and can you post your script ..
Thanks.

"Creativity is the ability to use your available resources to their fullest."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Just as a test, try using a Failure trigger (this can be a separate trigger from your custom trigger, and can lead nowhere, for example into a sequencer) - it is the existence of explicit failure handling that overrides automatic error handling.
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