Page 1 of 1

Parameter From Unix Script

Posted: Mon Jun 11, 2007 12:03 pm
by dtatem
Hello To All:

Is there a way to run a Unix shell script from within a DataStage job, get the value returned by it, and assign it to a job-parameter to be used in existing job(s)

Thanks

dtatem

Re: Parameter From Unix Script

Posted: Mon Jun 11, 2007 12:59 pm
by gateleys
dtatem wrote:Hello To All:

Is there a way to run a Unix shell script from within a DataStage job, get the value returned by it, and assign it to a job-parameter to be used in existing job(s)

Thanks

dtatem
You can't set the parameter of a job from within the same job. It will have to be done externally, say via the job sequence. You could write a routine with a DSExecute to fire the shell script and capture the return value. This routine may be triggered via a Routine Activity. Now, at the sequence level, the return value of Routine Activity can set the value of the job parameter of the specific job.

gateleys

Posted: Mon Jun 11, 2007 2:47 pm
by ray.wurlod
As suggested this can not be done in the job itself. However the approach suggested by gateleys adds an unnecessary layer of software; instead of a Routine activity, I would recommend an Execute Command activity to execute your script, upstream of your Job activity in a job sequence. The activity variable $ReturnValue can be used to retrieve the command's output for passing into a job parameter. You may need to Trim field marks (line terminators) from the script's output.