Accessing a Common Variable in the Job

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

Post by ray.wurlod »

Ranjan has not quite got it right. Stage variables are local not to the job, but only to the stage in which they appear. However, there is no reason not to pass the value of a stage variable along a link to a subsequent stage.

There are a very few COMMON variables that can be accessed in different locations in a job - these are the system variables such as @DATE and @USER.RETURN.CODE. Most of these are read-only, but the @USER.RETURN.CODE variable is there for you to use as you will. However, assigning a value can only be done in a Routine.

Ranjan's statement that COMMON variables are persistent through a job is also not correct. Variables declared as COMMON persist only in a process, and a job may execute in more than one process (and often does). This applies equally to the system variables and to user-defined COMMON variables.

The only "variable" that is always accessible everywhere in a job is the job's user status area, which can be assigned a value by invoking the DSSetUserStatus() function, and the value of which can be retrieved by the DSGetJobInfo() function or the DSUserStatus macro (for the currently executing job).



Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply