Page 1 of 1

Run ds jobs from Unix prompt and pass parameters

Posted: Tue Aug 12, 2003 2:14 pm
by renjithkk
How can I run the datastage jobs from unix command prompt. Also how can I pass parameters in the command to invoke datastage job and how can it be used inside the job.

Posted: Tue Aug 12, 2003 2:50 pm
by spracht
Ken and Raj kindly pointed me to the dsjob command line utility:
http://www.tools4datastage.com/forum/to ... C_ID=84826. Inside a job you can evoke it using ExecSH('UNIX', InputArg, Output).

Stephan

Posted: Tue Aug 12, 2003 3:57 pm
by kduke
Renjith

Parameters are used in the job in just about any way you want. Most of the time parameters are used to change DSN, UserId and Passwords. For example if you have a parameter named DwDSN then to use it in the value for the DSN on the connection of an ODBC or database stage then use #DwDSN#. The value of the parameter will be substituted at run time. The same for #DwUser# and #DwPwd# or whatever you call them. If you use a parameter in a derivation then use it like a stage variable just the name DwDSN and not #DwDSN#. You should always parameterize path names for hash files and sequential files. If you run out of disk space then you can move files around without changing jobs.

To run a job in a shell script then:

dsjob -server $SERVER -user $DSUSER -password $DSPWD -run -wait -mode NORMAL -param ParamName1=ParamValue1 -param ParamName2=ParamValue2 $PROJECT $JOB >> DsRun.log 2>&1

The dsjob command is very well documented. This should get you close.

I think you can check the return code from this command because of the wait option. dsjob can also check to see if jobs are running or aborted. The -jobinfo will show you running. The -logsum -type FATAL will show aborted.

Kim.

Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com

Posted: Tue Aug 12, 2003 4:51 pm
by ray.wurlod
Also be aware of the -jobstatus option, which acts like -wait but also reports various information about the job run onto stdout when the job completes.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518