A loop can be created in a Transformer stage by using DataStage stage variables. Transformer stage handles records one by one. Hence by storing the values in the stage variable we can perform the same action as we can do inside a loop. For example we have three records in the source like following and want concatenated value in one record.
1 Joe 2 Bloggs 3 Smith
Now in any procedural language we will be looping through these values and keeping the read values in variable and applying the concatenate operation. This would give us the required result. Similarly we will have to define two stage variables to create this loop. First stage variable will hold the value of source1.coulumn1 and second stage variable will have a derivation like StageVar2 = StageVar2:' ':StageVar1. These variables will store the values for the previous records as well as perform the operation. This how a loop can be implemented.
A loop can be created in a Transformer stage by using DataStage stage variables. Transformer stage handles records one by one. Hence by storing the values in the stage variable we can perform the same action as we can do inside a loop. For example we have three records in the source like following and want concatenated value in one record.
ReplyDelete1 Joe
2 Bloggs
3 Smith
Now in any procedural language we will be looping through these values and keeping the read values in variable and applying the concatenate operation. This would give us the required result. Similarly we will have to define two stage variables to create this loop. First stage variable will hold the value of source1.coulumn1 and second stage variable will have a derivation like StageVar2 = StageVar2:' ':StageVar1. These variables will store the values for the previous records as well as perform the operation. This how a loop can be implemented.