even-odd data

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

datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

even-odd data

Post by datastageforum@yahoo.com »

i want to capture even no. data in one file and odd no. data in another file,which one stage we will use and what properties we need to set?
Can we do it by filter stage if yes then what properties we need to set?
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Hope this will help,
1.Use Column Generator to generate a sequence
2.Use a stage Variable to get the MOD of the column divided by 2
3.Use Constraints to seperate the zero and Non-Zero value of the Stage Variable

Try this and post the feedback
RAJ
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Hope this will help,
1.Use Column Generator to generate a sequence
2.Use a stage Variable to get the MOD of the column divided by 2
3.Use Constraints to seperate the zero and Non-Zero value of the Stage Variable

Try this and post the feedback
RAJ
kamalshil
Participant
Posts: 179
Joined: Mon Jun 23, 2008 1:19 am

Post by kamalshil »

You can use same above technique and instead of Row generator for sequence you can use @INROWNUM system variable.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Even easier, use Modulus partitioning on a two-node configuration (or node pool) and have the Sequential File stage write two files.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

Post by datastageforum@yahoo.com »

can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

Post by datastageforum@yahoo.com »

can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

Post by datastageforum@yahoo.com »

can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
srinivas.g
Participant
Posts: 251
Joined: Mon Jun 09, 2008 5:52 am

Post by srinivas.g »

use stage variable like s=if(@inrownummond2=0) then '0' else '1'

Take two links first link constrsaiant is s=0(even data)
second link constariant is s=1 (odd data)
Srinu Gadipudi
datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

Post by datastageforum@yahoo.com »

is there any option in filter stage by that we can seperate even and odd number data
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

make it a Clear post!!
Do you want filter the records with respect to the VALUES in the column or the sequence of the records?
RAJ
datastageforum@yahoo.com
Participant
Posts: 11
Joined: Wed Nov 18, 2009 2:35 am

Post by datastageforum@yahoo.com »

Mr.GSSr i thnk u didn't get the question i want even records in one file and odd records in one file?is it possible to do it by filter or not if yes then how??
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Have you tried the solutions given?
RAJ
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Hi datastageforum guy

Its not proper to put two question marks in your question.
You are the person in need. Be humble. Its a free forum and no-one pays for answering your question

Regards
Sreeni
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

Hi,
transformer stage varible part

Code: Select all

   declare first two stage varibles in trasnformer
       a=@inrownumber(from system varible you wil get)
       b=if mod(a,2)=0 then 'even' else 'odd'( you wil get mod operator in functions--->mathematical )
constraint

Code: Select all

in the first constraint  give
      b='even'
in the second constraint give
      b='odd'
give two out putlinks

Thanks
vin..
Post Reply