transformer stage problem

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

transformer stage problem

Post by harikumar »

hi my source is like

empno,sal
1,2000
2,4000
4,5000
3,6000
5,4500
6,3400

target is like

empno,sal,sequnum
1,2000,2
2,4000,4
4,5000,6
3,6000,8
5,4500,10
6,3400,12

plz tell me the clear logic for generate evennumbers and oddnumbers using transformer stage(stagevariables)
jsuryanathan
Participant
Posts: 6
Joined: Tue Jun 15, 2010 11:17 am

Post by jsuryanathan »

Include the below code in transformation stage.
svSeqNum=@inrownum*2

For 1st record it will be 2
2nd row 4
3rd row 6

This is applicable to above data. You can change little as per your requirement
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

From your input sequnum=empno*2.

I dont see any odd numbers in your sequnum. Can you pl explain your requirement?
You are the creator of your destiny - Swami Vivekananda
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Both even and Odd in same output?
Looks like you need continues Sequence number.
If you want it seperately. Make the data to run in two node.
Make the Partition as Entire.
Run a SequenceGenerator.
One node will give you odd number and other will give you Even number.
For the same set of data.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
harikumar
Participant
Posts: 33
Joined: Wed Apr 21, 2010 9:19 pm
Location: banglore

hi

Post by harikumar »

anbu wrote:From your input sequnum=empno*2.

I dont see any odd numbers in your sequnum. Can you pl explain your requirement?
hi for the same table one of the case i want to genrate oddnumers like

empno,sal,sequnum
1,2000,1
2,4000,3
4,5000,5
3,6000,7
5,4500,9
6,3400,11 like this please tell me the logic
rohithmuthyala
Participant
Posts: 57
Joined: Wed Oct 21, 2009 4:46 am
Location: India

Post by rohithmuthyala »

You can use a similar formula like, sequnum=(empno*2) - 1
Rohith
ETLJOB
Participant
Posts: 87
Joined: Thu May 01, 2008 1:15 pm
Location: INDIA

Post by ETLJOB »

sequnum=(empno*2) - 1
I don't think "sequnum=(empno*2) - 1" would solve the purpose for the given sample data, considering the fact that employee number is not in sorted order.

I believe "sequnum=(@inrownum*2)-1" would do for you.
HariK
Participant
Posts: 68
Joined: Thu May 17, 2007 1:50 am

Post by HariK »

ETLJOB wrote:
sequnum=(empno*2) - 1
I don't think "sequnum=(empno*2) - 1" would solve the purpose for the given sample data, considering the fact that employee number is not in sorted order.

I believe "sequnum=(@inrownum*2)-1" would do for you.
"sequnum=(empno*2) - 1" will solve the problem whereas "sequnum=(@inrownum*2)-1" needs sorting for the data provided.
Post Reply