Page 1 of 1

How to achieve the Scenario???

Posted: Wed Jul 30, 2014 11:18 am
by 41ranjeet
Hi All,
Can any one help me achieving below scenario.

Input:
No Name
1 ABC
2 ABC
3 ABC
4 ABC
5 ABC
6 ABC
7 ABC
8 ABC
9 ABC
10 ABC
11 ABC
12 ABC
13 ABC
14 ABC
15 ABC
16 ABC
17 ABC
18 ABC
19 ABC
20 ABC
21 ABC
22 ABC
23 ABC
24 ABC

Target:1
No Name
1 ABC
2 ABC
3 ABC
4 ABC
5 ABC
6 ABC
7 ABC
8 ABC
9 ABC
10 ABC
21 ABC
22 ABC
23 ABC
24 ABC

Target:2
No Name
11 ABC
12 ABC
13 ABC
14 ABC
15 ABC
16 ABC
17 ABC
18 ABC
19 ABC
20 ABC

First 10 records has to written to Target1 and next 10 records to Target2 then again next 10 records needs to written to Target1 and so on...

Posted: Wed Jul 30, 2014 11:39 am
by chulett
And your target is?

Posted: Wed Jul 30, 2014 12:12 pm
by 41ranjeet
Target is flat file.

Posted: Wed Jul 30, 2014 12:51 pm
by chulett
Been discussed here quite a bit, here are some random examples. Can depend on how you want to control the naming of each file. The last one is specific to the 9.1 release as they added that functionality to the Sequential File stage in that release. Any other solution would be more of a 'workaround'.

viewtopic.php?t=150941
viewtopic.php?t=133224
viewtopic.php?t=151550

Posted: Wed Jul 30, 2014 1:32 pm
by 41ranjeet
Thanks Chulett for those links provided.I see in those links mainly discussed how to create dynamic flat file .In my requirement there will be only two target flat files How to distribute records among the target files as I asked above?

Posted: Wed Jul 30, 2014 1:52 pm
by chulett
Sorry, missed the point that it was only ever two. Then just two targets and constraints to send the rows to one or the other based on your row number. I would leverage the Mod() function and switch the output immediately after the result = zero, meaning you've just written the 10th record to the target.

Posted: Wed Jul 30, 2014 7:20 pm
by yugee
refer to the below post for Ray's solution using Mod function..
viewtopic.php?t=153014

Posted: Thu Jul 31, 2014 9:16 pm
by 41ranjeet
Thanks Chulett and Yugee for your quick help.Resolved.