Passing a variable between jobs

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to define a parameter in the second job to hold the variable and then use 'DSSetParam' in your controlling batch before running the job. From the help:

Syntax
ErrCode = DSSetParam (JobHandle, ParamName, ParamValue)

Example
The following commands set the quarter parameter to 1 and the startdate parameter to 1/1/97 for the qsales job.

paramerr = DSSetParam (qsales_handle, "quarter", "1")
paramerr = DSSetParam (qsales_handle, "startdate", "1997-01-01")

(ParamValue can also be a variable)

-craig
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the one job is not the controlling job of the other, there is no means for passing a variable via job parameters, nor any other mechanism for making the same variable visible in both jobs. This is mainly because the separate jobs run in separate processes with separate memory spaces and symbol (variable) tables.
Writing one or more values into a text file in one job and having the second job read them from there is reasonably efficient, though you may experience synchronisation issues. Similarly, one job could write information into a named pipe and the other job could read from the named pipe.
Post Reply