Run ds jobs from Unix prompt and pass parameters

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
renjithkk
Participant
Posts: 4
Joined: Tue Aug 12, 2003 1:26 pm
Location: India

Run ds jobs from Unix prompt and pass parameters

Post 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.
Last edited by renjithkk on Tue Dec 23, 2003 11:41 pm, edited 1 time in total.
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post 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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

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

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