FOR / DO Looping in 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
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

FOR / DO Looping in transformer

Post by agpt »

How do we implement FOR or DO looping in transformer?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

First let IBM release the next version of datastage :wink: and then you will be able to use looping variables. Till then use workarounds including parallel routines.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

Thats what exactly I am looking for.... with which work around I can implement it
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How about you first explain to us why you think you need to do "looping" in a transformer? Perhaps there is another way to accomplish whatever it is that you need to do.
-craig

"You can never have too many knives" -- Logan Nine Fingers
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

I have data like:

ID Flag
1 Y
1 N
1 Y
2 Y
2 Y
2 N
2 N
3 N
3 Y

The output I want is:

ID Flag
1 Y
2 Y
3 Y

That is across each id it would check for flag and if this is 'Y' against any occurence, It would give Y a final output with one occurence of ID.
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Post by truenorth »

If I interpret your logic correctly that you want one occurrence of Y's, then use the constraint Flag = 'Y' in Transformer together with either a Sort (no dups) or Dedupe.
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Or aggregate by ID and Max(flag)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or stage variable to detect whether 'Y' has been encountered, and either stage variables or Key Change column from Sort stage to detect change of key.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Trivial in a Server job as well. No looping required. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

hmm
Thanks to all.
Post Reply