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
Cherukuri
Participant
Posts: 46 Joined: Wed Jul 25, 2007 2:43 am
Location: India
Contact:
Post
by Cherukuri » Thu Sep 27, 2012 3:42 am
Question:
I have a data like :
PlNo ItmNo
LS8 AB
LS8 AB
LS5 CD
LS5 CD
I need the data like :
Identity PlNo ItmNo
1 LS8 AB
1 LS8 AB
2 LS5 CD
2 LS5 CD
Could experts help to give a solution for this.
Thanks.
Cheru.
Cheru
bhasds
Participant
Posts: 79 Joined: Thu May 27, 2010 1:49 am
Post
by bhasds » Thu Sep 27, 2012 5:03 am
Hi Cherukuri,
you can use 3 stage variables-
In stage variable-
Derivation Satage Variable
If col1<>SV2 And col2 <>SV3 Then SV1+1 Else SV1 SV1(initialize by 0)
col1 SV2(initialize by 0)
col2 SV3(initialize by 0)
In output-
In the third column derivation take the out put from SV1
BI-RMA
Premium Member
Posts: 463 Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg
Post
by BI-RMA » Thu Sep 27, 2012 6:18 am
Use a sort-stage and set the option "Create Key Change Column" to yes. Sort by PlNo and ItmNo. In a Transformer behind this evaluate Column KeyChange in a StageVariable.
If InputLink.KeyChange = 1 Then svIdentity +1 Else svIdentity
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Thu Sep 27, 2012 7:28 am
<moved from FAQ Discussions>
Next time please be more careful where you start your post.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Cherukuri
Participant
Posts: 46 Joined: Wed Jul 25, 2007 2:43 am
Location: India
Contact:
Post
by Cherukuri » Fri Sep 28, 2012 12:58 am
Hi bhasds
I tried your logic its worked fine.. :D
Thank you very much for your time and help.
Hi BI-RMA, Thank you for your inputs and am gone try your logic aswell.
Regads,
Cheru.
Cheru