I have a scenario like
Deptno=10---->First record and last record
Deptno=20---->First record and last record
Deptno=30---->First record and last record
I want those first and last records from each department in
a single target. How to do this in DataStage, any one can
assist me.
Thanks in advance.
Answer Posted / subhash
1.
Source--->Sort stage--->copy stage======>(SRC1,SRC2)
From copy stage we have to take two source stages
(SRC1,SRC2)
SRC-->Removeduplicate stage(in this we can get first
record from each dept--> Duplicates To Retain=First)
SRC2--->Remove duplicate stage(in this we can get last
record from each dept--> Duplicates To Retain=Last)
using funnel we can add these results.
2.
source->sortstage->removeduplications->dataset
in sortstage->create key changecolumn=true
this will set '1' for 1st records and '0' next duplicate
records.
after
removeduplicates stage(key columns=Deptno, CreateKeyChange
Columns)->duplicates retain:-last
we can get last(CreateKeyChange is zero and from all the
duplicates in that group, we are retaing last record) and
first(CreateKeyChange is 1) record group(Dept) wise.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the importance of the exception activity in datastage?
What is meta stage?
How to find value from a column in a dataset?
Field,NVL,INDEX,REPLACE,TRANSLATE,COLESC
explain about completely flow of sequencers technicaly,without using example??explain about lookup,nullhandling?
How do u convert the columns to rows in datastage?
Source has 2 columns: USA,NewYork INDIA,MUMBAI INDIA,DELHI UDS,CHICAGO INDIA,PUNE i want data in target like below: INDIA,MUMBAI1 INDIA,DELHI2 INDIA,PUNE3 USA,NEWYORK1 USA,CHICAGO2
What are some prerequisites for datastage?
What are the processing stages?
Difference between ‘validated ok’ and ‘compiled’ in data stage?
how to use self join using datastage ? can u tell me using stage how can we implemnet the self join
What are the stages in datastage?
Difference between IBM DATA STAGE8.5 and DATA STAGE9.1 ?
How to reverse the string using unix?
Explain connectivity between datastage with datasources?