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 are the primary usages of datastage tool?
What is the difference between datastage and datastage tx?
1)How will u implement SCD2 by using surrogate key. 2)What are the disadvantages with surrogate key. 3)How will you handle nulls in your project for the varchar, integer data types. 4)Can I use two fact tables in star schema. 5)3 jobs are running on the 2 nodes after I added one more node so can I compile those jobs to run on three nodes.
How do you start developing a datastage project?
Difference between in process and inter process?
Can you filter data in hashed file?
Can you highlight the main features of ibm infosphere information server?
what is repositery?
Hi everyone,I have kept a project Sales And Distribution for a pharmaceutical company.can anybody explain one complex business rule that we had in our project and how did you accomplish it using DS?
Name the different types of Lookups in Datastage?
Describe the architecture of datastage?
What are the functionalities of link collector?
Define orabulk and bcp stages?
What are stage variables?
Explain how a source file is populated?