How to achieve the Scenario???

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
41ranjeet
Participant
Posts: 8
Joined: Fri Jan 15, 2010 10:43 pm

How to achieve the Scenario???

Post 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...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And your target is?
-craig

"You can never have too many knives" -- Logan Nine Fingers
41ranjeet
Participant
Posts: 8
Joined: Fri Jan 15, 2010 10:43 pm

Post by 41ranjeet »

Target is flat file.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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
-craig

"You can never have too many knives" -- Logan Nine Fingers
41ranjeet
Participant
Posts: 8
Joined: Fri Jan 15, 2010 10:43 pm

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
yugee
Participant
Posts: 34
Joined: Fri Feb 04, 2011 5:54 pm

Post by yugee »

refer to the below post for Ray's solution using Mod function..
viewtopic.php?t=153014
41ranjeet
Participant
Posts: 8
Joined: Fri Jan 15, 2010 10:43 pm

Post by 41ranjeet »

Thanks Chulett and Yugee for your quick help.Resolved.
Post Reply