Page 1 of 1

passing parameters for dsjob

Posted: Sun Apr 23, 2006 10:21 pm
by vinodhraj
Hi DSGurus,

How to pass parameters for running a job in unix (dsjob -run <<project name>> <<name job name>>)

let say the parameters were located in a table

Thanks

vinod

Posted: Sun Apr 23, 2006 10:30 pm
by kcbland
Methinks some scripting would come it handy. Perl, ksh, bsh, whatever your preference. :wink:

Posted: Sun Apr 23, 2006 11:06 pm
by ray.wurlod

Code: Select all

dsjob -run -param name1=value1 -param name2=value2 -jobstatus project job
It's your choice as to how to get them out of a table, presumably into script (shell) variables.

I'd prefer an approach using a job sequence, but you specified "from the operating system".

Posted: Sun Apr 23, 2006 11:12 pm
by koolnitz
You can even store all your parameters in a flat file and pass this file to -param argument.

The format of the parameter file should be:
paramater1=value
parameter2=value
parameter3=value
..
..

And your command would become

dsjob -run -param parameterfile.txt project job

Posted: Sun Apr 23, 2006 11:54 pm
by sb_akarmarkar
Nitin,

I think we cannot use parameter file as you mention.

We can use parameter in following way only as i know..

dsjob -run -param name1=value1 -param name2=value2 project job


Thanks,
Anupam

Posted: Mon Apr 24, 2006 12:35 am
by koolnitz
Oh yess..

The command would remain
dsjob -run -param name1=value1 -param name2=value2 project job

Anupam is right that for each parameter used in the job we need to specify in -param argument,
-param name1=value1, name2=value2, ... , namen=valuen

Still we can have a file where we keep all the parameters used in the job, in the format explained in previous post and can use it to pass the value to parameters in the command line, like..

dsjob -run -param name1=$value1 -param name2=$value2 project job, where values to $value1 and $value2 variables are passed from the flat file.

Moreover you can use -lparams option with dsjob command to automate fetching the parameters defined in jobs if you have more than one jobs to run through single script. This way, you facilitate all the jobs to get their parameters' value from a single parameter file.

Posted: Mon Apr 24, 2006 1:11 am
by ray.wurlod
koolnitz wrote:You can even store all your parameters in a flat file and pass this file to -param argument.

The format of the parameter file should be:
paramater1=value
parameter2=value
parameter3=value
..
..

And your command would become

dsjob -run -param parameterfile.txt project job
Is this documented somewhere? (I don't have access to DataStage at the moment.)

Posted: Mon Apr 24, 2006 1:22 am
by koolnitz
Ray, please refer to my last reply on this thread.

dsjob -run -param parameterfile.txt project job is wrong command as pointed out by Anupam.

I am not sure if this format has been documented anywhere, but this is what we are using in many of our projects, and it's working absolutely fine.

We are maintaining multiple such parameter files, and based on the requirement we pass the different parameter file to the script where we kick off DS jobs, and there it passes the values to the job parameters.