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 some prerequisites for datastage?
what is the difference between == and eq in UNIX shell scripting?
Enlist various types of routines in datastage.
What is datastage engine?
Which algorithm you used for your hashfile?
Differentiate between hash file and sequential file?
What is the method of removing duplicates, without the remove duplicate stage?
i have a job with 3 possibiliies finish with ststus ok abbort warning how do you handle these 3 in job sequence? explain the situation where you have appiled scd in your project? chandu
How can one find bugs in job sequence?
8000 jobs r there i given commit, suddenly job will abort? what happens? 2)diff b/t transformer stage & filter stage? 3)how to load the data in the source?
If you want to use a same piece of code in different jobs, how will you achieve this?
what is use of SDR function?
What is the precedence of stage variables,derivations, and constraints?
What is job control?
options available in sequence job to run,validate?