Page 1 of 1

Invalid Arguments when run from command line

Posted: Fri Mar 24, 2006 3:59 pm
by kaps
Guys

when I run job from command line using the scipt given below I am getting "Invalid arguments:dsjob -run" error...

I took the piece of code which assigns the parameters from parameter file from one of the post here...
It looks like thats where I am having problem.

This is the shell I am executing...say(runjob.sh)

#!/usr/bin/ksh

PROJECT=$1
shift
DSJOB=$1
shift
SET_PARAMS="$*"
cd $DSHOME
. ./dsenv

dsjob -run ${SET_PARAMS} $PROJECT $DSJOB
return_val=$?
if test $return_val -eq 0
then
echo "success"
else
echo "failure"
fi
exit $return_val




My parameter file looks like this...
-param prm_one=somevalue

I execute it like this...
runjob.sh Project_Name Job_Name ParameterFile_Name


Error is...
Invalid arguments:dsjob -run

any input is appreciated...

[/code]

Posted: Fri Mar 24, 2006 4:07 pm
by DSguru2B
I execute it like this...
runjob.sh Project_Name Job_Name ParameterFile_Name
from a glance, i see that you are providing the ParameterFile_Name at the end, where as in your script you have specified that as the first argument.

Try this

Code: Select all


runjob.sh  ParameterFile_Name Project_Name Job_Name


Posted: Fri Mar 24, 2006 4:23 pm
by kaps
Thanks for the reply. do you see "shift" in the code after every parameter I believe that takes care of parameter assignment. I don't think that causes the problem.

Posted: Fri Mar 24, 2006 5:08 pm
by ray.wurlod
Given that you're picking up the parameter setting arguments with $* are you correctly specifying them as "-param name=value" when invoking your script?

Your shift command will move the parameter list to the left. So you lose the parameter file first. Probably not what you wanted. (Add echo statements to the script to report what's left in the command buffer.)

Or try something like

Code: Select all

runjob.sh  Project_Name Job_Name -param ParamFile=ParameterFile_Name 

Posted: Fri Mar 24, 2006 5:39 pm
by kaps
Thanks for the ideas. I was able to run it successfully like this....

runjob.sh project_name job_name -param prm_1=val1 -param prm_2=val2

But what I am looking for is a way to get these parameters from parameter file dynamically when I run the job instead of mentioning them one by one. I know we can do this using DataStage(basic code or routine) but I am looking for options in unix.

Thanks

Posted: Sat Mar 25, 2006 1:04 am
by ray.wurlod
The thing you need to invoke from the command line is a job sequence that reads the parameter file then uses the results from that to provide parameter values to job activities that are downstream in the job sequence.

Re: Invalid Arguments when run from command line

Posted: Sat Mar 25, 2006 1:57 am
by chulett
kaps wrote:I took the piece of code which assigns the parameters from parameter file from one of the post here...
You've posted the same thing here and at ADN and both times said it was a post 'here'... which here is here? Can you provide a link to the original post? That may help clear things up.

Posted: Mon Mar 27, 2006 1:12 pm
by kaps
Criag

Sorry for the confusion. here means here is DSXchange. It's the script written by Kim Duke(Runjob.ksh) long back.

Thanks
Kaps

Posted: Mon Mar 27, 2006 1:12 pm
by kaps
Criag

Sorry for the confusion. here means here is DSXchange. It's the script written by Kim Duke(Runjob.ksh) long back.

Thanks
Kaps

Posted: Mon Mar 27, 2006 1:25 pm
by chulett
Do you have a link back to the original post?

Posted: Mon Mar 27, 2006 7:22 pm
by kduke