Execute Command Stage

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
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Execute Command Stage

Post by gsym »

Hello,

I have a script, test.sh
========
#! /bin/ksh
if [-s $1]
then echo 0
else echo 1
fi
========
When i execute it I'm passing parameter (a filename).
> test.sh filename.txt
Everything is fine, the script returns 0 if the file has any data and vice versa.

When I call the same script in DataStage in the execute command stage,
I'm always getting the output as 1(From log)

Any suggestions.

Thank You -gsym
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

File name or file pathname?

DataStage probably does not execute in the same directory as the one in which you execute the script.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Post by gsym »

Hi,

I tried,

filepath/test.sh filepath/filename.txt

Now I got the output from compand as 0, but reply is 1 now (and got warning) and job got aborted.

Thanks - gsym
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's how default handling of non-zero exit status works. To override it handle the "failure" condition explicitly with a trigger.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Post by gsym »

Got, It - Thank You
Post Reply