Passing Parameters through dsjob function

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
prasad_mvan
Participant
Posts: 3
Joined: Thu Feb 08, 2007 3:44 pm
Location: Sydney

Passing Parameters through dsjob function

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
prasad_mvan
Participant
Posts: 3
Joined: Thu Feb 08, 2007 3:44 pm
Location: Sydney

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

Post 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)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
prasad_mvan
Participant
Posts: 3
Joined: Thu Feb 08, 2007 3:44 pm
Location: Sydney

Post 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 ?
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post 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.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
parimi123
Participant
Posts: 12
Joined: Fri Nov 04, 2005 9:43 am
Location: Atlanta

Post by parimi123 »

it is saying it could not find the PROJECT
Did you change working directory to your project directory before executing dsjob

Poorna
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

parimi123 wrote: Did you change working directory to your project directory before executing dsjob
Poorna
I highly doubt thats required Poorna.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
parimi123
Participant
Posts: 12
Joined: Fri Nov 04, 2005 9:43 am
Location: Atlanta

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

Post 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
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply