Hi,
My Source is Dummy sequential file.
And My routine returns a single line like
record1|record2\record3|record4\record5|...
Target is Sequential file.
I should get all the odd numberrecords(For Eg:1,3,5..)into column1 and even number records(2,4,6..)into column2.
COLUMN1,COLUMN2
record1,record2
record3,record4..
Any help...
Thanks,
Dslea
Routine returns a single line....
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 252
- Joined: Mon Sep 19, 2005 10:28 pm
- Location: Melbourne, Australia
- Contact:
Create a Transformer with two Stage Vars:
- Name = OddRow, Derivation = EvenRow
- Name = EvenRow, Derivation = InLink.ColName
In this way, EvenRow always contains the contents of the current row, and OddRow contains the contents of the previous row. Now, if you only output every second row, you'll get what you want.
Create an output link with two columns:
- Name = EVEN_ROW, Derivation = EvenRow
- Name = ODD_ROW, Derivation = OddRow
Add a constraint to the output link so that it only outputs even numbered rows:
Constraint: Mod(@INROWNUM, 2) = 0
- Name = OddRow, Derivation = EvenRow
- Name = EvenRow, Derivation = InLink.ColName
In this way, EvenRow always contains the contents of the current row, and OddRow contains the contents of the previous row. Now, if you only output every second row, you'll get what you want.
Create an output link with two columns:
- Name = EVEN_ROW, Derivation = EvenRow
- Name = ODD_ROW, Derivation = OddRow
Add a constraint to the output link so that it only outputs even numbered rows:
Constraint: Mod(@INROWNUM, 2) = 0
Ross Leishman