Page 1 of 1

reading stage variable in another stage

Posted: Tue Apr 05, 2005 4:17 pm
by santosh
Is there any way where I can pass stage variable(transformer stage) to another stage in same job?

Incidence in my job:
I have to read a typical mainframe file having header, detail and trailer. In trailer there is count of detail records specific. My job needs to verify actual count of records with count provided in trailer.

I am counting total detail records in aggregator. Another stage uses column Import stage to get the count from trailer in a transformer stage.
Now I want to check both counts and abort job if they do not match?
Any Idea on how this can be done.

Also another requirement is I need to write message saying " Trailer records Msmatch" in Datastage joblog before aborting the job.

Thanks in advance,
Santosh

Posted: Tue Apr 05, 2005 6:51 pm
by ray.wurlod
Add an extra column to the output link of the Transformer stage. The derivation for this column is the value of the stage variable. This remains available in downstream stages as far as you want to propagate it.

Re: reading stage variable in another stage

Posted: Wed Apr 06, 2005 9:18 am
by sachinkc
You can't. Stage variable stays in the Stage.

Ray's method is a good way. You can concatenate (with ":") any other value to it and propogate it downstream too.

- Sachin

Re: reading stage variable in another stage

Posted: Wed Apr 06, 2005 9:41 am
by santosh
sachinkc wrote:You can't. Stage variable stays in the Stage.

Ray's method is a good way. You can concatenate (with ":") any other value to it and propogate it downstream too.

- Sachin
Thanks Ray , Sachin:
I was trying to assign a job variable in transformerA and use it in another transformerB which is not downstream to this stage. But I am sure that transformer B will run after transformerA and I would access job varible to take decesion in transformerB.

Can I assign job variable in stage. Or any other way I can achieve above functionality?

regards,
Santosh

Re: reading stage variable in another stage

Posted: Wed Apr 06, 2005 11:15 am
by sachinkc
Store the o/p of xfmA in some temp file (which includes the value of xfmA Stage var), read it along with xfmA Stage var in xfmB.

- Sachin
santosh wrote:
Thanks Ray , Sachin:
I was trying to assign a job variable in transformerA and use it in another transformerB which is not downstream to this stage. But I am sure that transformer B will run after transformerA and I would access job varible to take decesion in transformerB.

Can I assign job variable in stage. Or any other way I can achieve above functionality?

regards,
Santosh

Re: reading stage variable in another stage

Posted: Wed Apr 06, 2005 3:54 pm
by santosh
Thanks Sachin,


sachinkc wrote:Store the o/p of xfmA in some temp file (which includes the value of xfmA Stage var), read it along with xfmA Stage var in xfmB.

- Sachin
santosh wrote:
Thanks Ray , Sachin:
I was trying to assign a job variable in transformerA and use it in another transformerB which is not downstream to this stage. But I am sure that transformer B will run after transformerA and I would access job varible to take decesion in transformerB.

Can I assign job variable in stage. Or any other way I can achieve above functionality?

regards,
Santosh

Posted: Wed Apr 06, 2005 4:24 pm
by ray.wurlod
You could also store the value in the job's user status area, and retrieve it from there in TransformerB.
However, under the covers this does a write to disk anyway, so there's no gain (and there is some pain) in using this method.