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


Please Help Members By Posting Answers For Below Questions

What are routines in datastage?

1068


How many types of hash files are there?

845


why do u need the IOS upgradation in a FC switch

2048


What is use Array size in datastage

1534


What are the processing stages?

851


What is the difference between odbc and drs stage?

836


To see hidden files in LINIX?

1177


describe the Steps to confiure a Qlogic switch

2153


Field,NVL,INDEX,REPLACE,TRANSLATE,COLESC

1178


Why do you need stage variables?

917


What is the difference between informatica and datastage?

888


What is meta stage?

931


What are the main differences you have observed between 7.x and 8.x version of datastage?

839


What are the types of containers?

915


What is the method of removing duplicates, without the remove duplicate stage?

776