Invalid Arguments when run from command line

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
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Invalid Arguments when run from command line

Post 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]
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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

Re: Invalid Arguments when run from command line

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post 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
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you have a link back to the original post?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Mamu Kim
Post Reply