3

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.

The Guy with The Hat
  • 10,836
  • 8
  • 57
  • 75

2 Answers2

2

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.

Wh1T3h4Ck5
  • 8,399
  • 9
  • 59
  • 79
RAJAT BHATHEJA
  • 587
  • 4
  • 4
1

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

  • Note, You just need the input data:(0) instead of Data:(0,1) So please adjust your Row generator to give only 1 row as output with value 0 – Nac_user3432161 Mar 18 '14 at 08:29