Shell script through before job subroutine

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
austin_316
Participant
Posts: 80
Joined: Fri Aug 21, 2009 7:49 am
Location: India

Shell script through before job subroutine

Post by austin_316 »

hi,
i have a shell script which has the code like this

FATAL=0
SUCCESS=1
SOURCEFILAPATH=$1
FILENAME=$2

if test -w $SOURCEFILEPATH/$FILENAME
then
echo "$FILENAME HAS BEEN RECEIVED "
else
echo "$FILENAME IS NOT PRESENT IN THE PATH "
exit $FATAL
fi


The file text1.txt is present under the path /home/sourcefile
when i execute this shell script from Sequence Job using a ExecuteCommand stage like this "sh /home/script/checkfile.sh /home/sourcefile text1.txt" it is working fine and is giving the output "text1.txt HAS BEEN RECEIVED"
But when i call the shell script from my beforejob subroutine in this way
"Call DSExecute("UNIX","sh ":ScriptDIR:"/FCA_BAND_FILECOUNT_CHK.sh ":"/home/sourcefile text1.txt >":LogDIR:"/LogFile.txt",Output,SystemReturnCode)"

then in the lofile LogFile.txt iam getting the statement as "text1.txt IS NOT PRESENT IN THE PATH"

please help me in this.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

When you say Before job subroutin, I beleive, you calling in the General tab of Job paramter. If thats the case, You can specify the follwing in the "ExecSH"
"sh /home/script/checkfile.sh /home/sourcefile text1.txt"
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
antonyraj.deva
Premium Member
Premium Member
Posts: 138
Joined: Wed Jul 16, 2008 9:51 pm
Location: Kolkata

Post by antonyraj.deva »

Just a small note.

In the script, the starting "fi" is missing so I doubt if the script will work correctly.
TONY
ETL Manager
Infotrellis India

"Do what you can, with what you have, from where you are and to the best of your abilities."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Stick some echo commands into the script to determine what the received command line arguments are. These can be removed or crippled once your debugging session is done.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Check the permissions for the file and directory.

Maybe you are running datastage with different user and it cannot see the file.
Post Reply