even records one target,odd number records one target

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
harikumar
Participant
Posts: 33
Joined: Wed Apr 21, 2010 9:19 pm
Location: banglore

even records one target,odd number records one target

Post by harikumar »

i have source like
deptno,sal
1,2000
2,3000
3,4000
1,2300
4,5000
5,1100

i want target like

target1
deptno,sal
1,2000
3,4000
4,5000

target2
2,3000
1,2300
5,1100


with out using transformerstage
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Filter stage.
udayk_2007
Participant
Posts: 72
Joined: Wed Dec 12, 2007 2:29 am

Post by udayk_2007 »

using MOD (divide by 2) Function on dept column in modify stage,and followed by a filter stage should solve the problem.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Please note that unless you set the job to process the data sequentially you are not going to get the output you expect - each node in the parallel job will grab odd / even records in your filter stage.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Questions like this worry me. Either they are interview questions (which bothers me in any case) or someone is looking for a complicated solution to a simple problem. The transform stage would easily do this using @INROWNUM or, if parallel processing is being done, by @PARTITIONNUM + ( @NUMPARTITIONS * ( @INROWNUM -1 ) ) + 1 and two output links. Such a simple, efficient and clear solution to the request and yet the OP is asking to do it another way. Why?
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

have a stage variable Mod(AsInteger(input column),2)

i will retun 1 or 0

1=True means Odd rows
0=False Even records

in Constarint specify StageVar=1 in first link.

in Constarint specify StageVar=0 in second link.
Regards
LakNar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

lakNAR - he doesn't want to use a transform stage...
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I agree with Arnd, why?
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I agree with Kim, why?

If it's odds and evens, you could use a two-node configuration and round-robin partitioning, or you could use a single-node configuration and a Column Generator and a Filter stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
varunndschange
Participant
Posts: 4
Joined: Mon Jul 05, 2010 1:21 am

Post by varunndschange »

If you want it to achieve without transformer ... First perform hash partitioning on deptno and sal and then you can use a row generator and generate rows for a new dummy column with initial value as 1 and increment by 1..
This way each row is assigned a unique value.. Now use filter stage and filter on the conditions as:
dummy_col%2<>0
dummy_col%2=0
Varun Negi
Assistant System Enginner
TCS
Post Reply