Stage Variable

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
priyaram
Charter Member
Charter Member
Posts: 16
Joined: Fri Apr 23, 2004 7:39 pm

Stage Variable

Post by priyaram »

Hi
what is meant by stage variable in Transformer and when we need to use that variable
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's a local variable, something that can come in very handy - at least in Server jobs. Not positive about their role or pros/cons in PX jobs, if any. This post should help. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
mouthou
Participant
Posts: 208
Joined: Sun Jul 04, 2004 11:57 pm

Post by mouthou »

the stage variables are some temporary variables defined in the transformer to play internally within it. it is very helpful in terms of complex calculations involving many intemediate calcualtions. if there is a field "FIELD1" for which the calculation is x * y + z. Inturn x,y,z has got some more calculations , you can define x,y and z as the stage variables and define the formula for each of this. And in the transformer, you can use the stage variables to calcualte FIELD1 directly. 8)

And it has got re-usability too. if more than one field has got similar type of calcuations with little bit additions, you can use these stage varibles without re-typing the calculation in the transformer. Also that you can play internally within the stage variable. one calclated variable can be used for another. in that order of the calculatoin is very important.

As far as I know there are no "cons" for stage variables.

Thanks,
biswajit_paul
Participant
Posts: 16
Joined: Tue Apr 22, 2003 3:37 am
Location: USA
Contact:

Post by biswajit_paul »

mouthou wrote:the stage variables are some temporary variables defined in the transformer to play internally within it. it is very helpful in terms of complex calculations involving many intemediate calcualtions. if there is a field "FIELD1" for which the calculation is x * y + z. Inturn x,y,z has got some more calculations , you can define x,y and z as the stage variables and define the formula for each of this. And in the transformer, you can use the stage variables to calcualte FIELD1 directly. 8)

And it has got re-usability too. if more than one field has got similar type of calcuations with little bit additions, you can use these stage varibles without re-typing the calculation in the transformer. Also that you can play internally within the stage variable. one calclated variable can be used for another. in that order of the calculatoin is very important.

As far as I know there are no "cons" for stage variables.

Thanks,
Just to add my 2 cents: The stage variable also can be used in the constraints. If you have a complex constraint, you can derive it in the stage variable and use it in the constraints.

The execution order in the transformer is: stage variable -> Constraints -> derivations.
Post Reply