Page 1 of 1

Passing Parameters through dsjob function

Posted: Thu Feb 08, 2007 4:02 pm
by prasad_mvan
Hi

I am reading parameters from .csv file using shell script, and trying to execute the DataStage Sequence job by passing the paramters to it, as follows.

dsjob -run -param abc=$abc -param DBname=$DBname PROJECTNAME SEQ_JOBNAME

I am getting Invalid arguments dsjob -run Error

Status code = -9999 DSJE_DSJOB_ERROR.

Even if I use the -mode parameter I am getting the same error.

dsjob -run -mode NORMAL -param abc=$abc -param DBname=$DBname PROJECTNAME SEQ_JOBNAME


Can anyone help how to pass the parameters through commandline ?

Thanks for any help

Venkata

Posted: Thu Feb 08, 2007 4:08 pm
by ArndW
You need to specify the -MODE NORMAL. Is your project actually called "PROJECTNAME"? What happens if you try to start the job by typing in all the actual values?

Posted: Thu Feb 08, 2007 4:10 pm
by DSguru2B
Do any of your parameter values contain spaces. If yes then they should be present within quotes in your csv file and you need to add "eval" before the dsjob command.

Posted: Thu Feb 08, 2007 4:14 pm
by prasad_mvan
ArndW wrote:You need to specify the -MODE NORMAL. Is your project actually called "PROJECTNAME"? What happens if you try to start the job by typing in all the actual values? ...

There are all together 29 parameters, it is saying it could not find the PROJECT.

Posted: Thu Feb 08, 2007 4:15 pm
by DSguru2B
Thats what ArndW asked you, Is your project really called PROJECTNAME or thats just a variable. If its a variable then you need to prefix it with dollar sign ($PROJECTNAME)

Posted: Thu Feb 08, 2007 4:27 pm
by prasad_mvan
DSguru2B wrote:Thats what ArndW asked you, Is your project really called PROJECTNAME or thats just a variable. If its a variable then you need to prefix it with dollar sign ($PROJECTNAME)
DSguru2B wrote:Thats what ArndW asked you, Is your project really called PROJECTNAME or thats just a variable. If its a variable then you need to prefix it with dollar sign ($PROJECTNAME)
PROJECTNAME is actually my Project Name, I have tried to used

eval dsjob -run -mode NORMAL -param BATCHNUMBER=$BATCHNUMBER -param log=$log PROJECTNAME SEQ_jobname

but i am still getting error. I would like to know

-param BATCHNUMBER="$BATCHNUMBER"
-param BATCHNUMBER=%$BATCHNUMBER%
-param BATCHNUMBER='$BATCHNUMBER'

is needed ?

Posted: Thu Feb 08, 2007 5:34 pm
by us1aslam1us
Have you tried the first option, that should take care of the value fi it is having any spaces.

Code: Select all

-param BATCHNUMBER="$BATCHNUMBER"
Check your file to verify the parameter names and Let us know what error message it is giving.

Posted: Thu Feb 08, 2007 6:47 pm
by DSguru2B
You dont need quotes around the variable. Somewhere you are missing a space or something. I thought you said its complaining about the project name?

Posted: Thu Feb 08, 2007 8:20 pm
by kduke
If you are in UNIX then the -param is the option and the ParamName=ParamValue is the option value and the whole thing needs quotes if there are spaces. So -param "ParamName=$ParamVariable" is more accurate. If the parameter value has quotes in it then you have yet another problem.

Do us a favor and put an echo "dsjob..." and post that so we can see if there are any other special characters. please edit out your passwords.

Posted: Fri Feb 09, 2007 1:12 pm
by parimi123
it is saying it could not find the PROJECT
Did you change working directory to your project directory before executing dsjob

Poorna

Posted: Fri Feb 09, 2007 1:28 pm
by DSguru2B
parimi123 wrote: Did you change working directory to your project directory before executing dsjob
Poorna
I highly doubt thats required Poorna.

Posted: Fri Feb 09, 2007 2:03 pm
by parimi123
May be, but this is how i'm running the jobs from a unix shell.

dsjob -file ${file} ${servername} -run -warn ${WARNING_LIMIT} -jobstatus -local ${PROJECT_NAME} ${JOB_NAME}

In my previous post I forgot to mention about using -local option.

-local option is required if your Job needs to take environmental variables.

-mode NORMAl option is not required if you just want to run the job.

Server Job Developers Guide says:
-local use this when running a DataStage job from withing a
shellscript on a UNIX server. Provided the script is run in the project
directory, the job will pick up the settings for any environment
variables set in the script and any setting specific to the user
environment.

Thanks,
Poorna

Posted: Fri Feb 09, 2007 2:22 pm
by DSguru2B
parimi123 wrote: -local option is required if your Job needs to take environmental variables.
-local might be required to pick up environment variables. Granted. I dont use environment variables. Hence cannot comment more on it.
parimi123 wrote: -mode NORMAl option is not required if you just want to run the job.
-mode option is optional. If -mode is not specified, a normal job run is started. Hence its is not required