Retain loop variable value in a transformer?

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
mctny
Charter Member
Charter Member
Posts: 166
Joined: Thu Feb 02, 2006 6:55 am

Retain loop variable value in a transformer?

Post by mctny »

Hi,

I have a question, I need to store the last value of a loop variable so that I can use it in the output link ( or in the new loop) in a column for the other rows. The output link has a constraint which filter the row for which the loop variable is calculated.

Loop value is reset to its initial value each for each row and I can not save it to access for the next row. can I store it at the last iteration for the first row so that I can access it processing for the next row?

Thanks in advance
Karthik.M
Participant
Posts: 24
Joined: Thu Apr 26, 2012 1:18 am
Location: Chennai,TamilNadu

Post by Karthik.M »

This is simple in DataStage 8.5.

A new utility function "SaveInputRecord" is available in Transformer stage which can be mapped with the loop variable and the output link can be mapped to another utility function "GetSavedInputRecord".
Karthik.M
Analyst
Infotrellis.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That would be a much more useful reply had you elaborated on how to achieve the "with the loop variable" part.

It seems to me that a straightforward approach would be to use stage variables to "remember" the value from the previous record, perhaps using the DCount() function to establish the number of elements.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply