for loop

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
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

for loop

Post by RAJEEV KATTA »

Hi,

How do we use a for loop similar functionality in a parallel transformer.for loop similar functionality is available in server job transformer where in we give initial value in stage variables and condition in constraint which would serve the purpose same as for loop.But in parallel transformer this doesnot work,so is there any function which serves the same purpose.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The FOR-NEXT loop is not available in Server transform stages.

Please explain what you are trying to loop in a stage and someone might be able to think of a way to do this.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You may be referring to a server routine invoked from a Transformer stage.

In a parallel routine you can also construct a loop. You just need C syntax for the loop (because a parallel routine is coded in C++). A parallel routine can be invoked from a parallel Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

Post by RAJEEV KATTA »

for next loop similar functionality is there in transformer.For example I want the no's from 1 to 10 in output what I do is first I'll take a stage variable i=0 and then in the transformer constraint I say i <11 and my ouput column is also stage variable i then all the values from 1 to 10 would be sent to output.How do I do the same operation in parallel transformer.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The stage variable and constraint method is identical in PX transformers, so you can do it exactly as you would in Server jobs.
wuv
Participant
Posts: 1
Joined: Wed Aug 22, 2007 12:50 am
Location: Sydney

Post by wuv »

RAJEEV KATTA wrote:for next loop similar functionality is there in transformer.For example I want the no's from 1 to 10 in output what I do is first I'll take a stage variable i=0 and then in the transformer constraint I say i <11 and my ouput column is also stage variable i then all the values from 1 to 10 would be sent to output.How do I do the same operation in parallel transformer.
You need a Row Generator stage. Just use a dummy column and limit the number of rows to 10, and link into the transformer. You can use the @OUTROWNUM for output.

Careful with the partitioning though. Simplest solution is to specify the two stages as "sequential".
Vincent
Post Reply