I'm trying to get an output of Fibonacci sequence in Datastage. I am trying it with a row generator-->Transformer-->Sequential File. My data inside row generator is (0 and 1). I have no idea what to put in my transformer.
Data:0,1
The output should be (0,1,2,3,5,8,13,21,34). The number should be only up to 100, so I'm thinking of a loop variable.
we can do this using three loop variables.
Name --> Derivation
varSum-->if (@ITERATION=1) then 0 else if (@ITERATION=2) then 1 else varFirst+varSecond
varFirst --> varSecond
varSecond --> varSum.
output will be varSum
from row generator u can get a single row to complete the job.
Create 4 loop Variables in exact sequence as given below
Variable--> Derivation
Output--> ThirdValue
ThirdValue--> FirstValue + SecondValue
FirstValue--> If @ITERATION = 1 Then InputLink.InputValue Else SecondValue
SecondValue--> ThirdValue
Give this looping condition ---> @ITERATION = 1 Or ThirdValue < 100
Take Output to your output file column
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With