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.

Answers were Sorted based on User's Feedback



I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / ashok

Source--->Sort stage--->copy stage
From copy stage we have to take two source stages
(source1,source2)
source1-->Removeduplicate stage(in this we can get first
record from each dept)
source2--->Remove duplicate stage(in this we can get last
record from each dept)
using funnel we can add these results.

Is This Answer Correct ?    10 Yes 4 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / d anil babu

take source--->copy---->remove dupli stage---->
----->remove dupli stgae-->funnel-->dataset
in first remove duplicate stage select duplicate retain first
in second rmd select duplicate retain last and in funnel u
have to select the sort funnel

Is This Answer Correct ?    3 Yes 1 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / amjad pasha

SOURCE ---> SORT STAGE(sort key mode = sort, create cluster
key change column and create key change column should be
false) ---> COPY STAGE ---> (2 REMOVE DUPLICATE STAGES)
REMOVE DUPLICATE STAGE_1 (key=dept and Duplicate to Retain
= First) AND REMOVE DUPLICATE STAGE_2 (key=dept and
Duplicate to Retain = Last) ---> FUNNEL STAGE (Funnel
Type=Continues Funnel) ---> TARGET

Is This Answer Correct ?    2 Yes 0 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / prabhu

source->sortstage->removeduplications->dataset

in sortstage->create key changecolumn=true
after
removeduplicates stage->duplicates retain:-last
we can get last and first record group wise.

Is This Answer Correct ?    4 Yes 2 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / 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

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / naga

take a sequential file and give the output link to copy
stage and from copy stage give one output link to head
stage and one output to tail stage and in head and tail
stages give no. of partitions per record =1 and give the
output to funnel stage and give funnel type = sequence and
mention the link order to displays which records first and
give the output link to dataset and you will get the output
you want

Is This Answer Correct ?    4 Yes 3 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / c raghavendra nivas

      
             -------removeduplicate(first)
source---copy                    ------funnel----output
             -------removeduplicate(last)

it works i did it
try if u want

if its a database you can do witha co-related sub query

Is This Answer Correct ?    0 Yes 0 No

I have a scenario like Deptno=10---->First record and last record Deptno=20---->First recor..

Answer / naga

take sequential file and give its output to copy and copy
it to two datasets.in one dataset select the partition on
deptno type=modulus and perform sort and select both stable
and unique you will get first redcords and in another
dataset select partition on deptno and type modulus and
perform sort and select only unique and give give both
dataset outputs to funnel and give its output to dataset

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Data Stage Interview Questions

What is the difference between validated and compiled in the datastage?

0 Answers  


how many dimentions and fact tables used in your project and what are names of it?

3 Answers   Tech Mahindra,


Hi , Today 1000 records updated, tomorrow 500 records updated how to find that?

4 Answers   Wipro,


how to sort two columns in single job in datastage.

0 Answers   TCS,


in datastage scenario this is sourec data i want this traget? tell me please? source target ------- ------- Mohan,Prasad,Naresh Mohan Prasad Naresh

1 Answers   IBM,






1.i have 5 jobs(1-5),i connect with each other,i want run from 3-5 only how? 2.how to schedual the job in datastage7.5 2? what is the deff bet grip and fgrep command? how do you cleanse the data in your project

1 Answers   Accenture,


Define orabulk and bcp stages?

0 Answers  


create a job to get the previous row salary for the current row.if there is no previous row exists for the current row,then the previous row salary should be displayed as null? empid   salary   previoussalary 10      1000     null 20      2000     1000 30      3000     2000       40      4000     3000

5 Answers   Genpact,


how to transfer file from one system to another system in unix? which cmd to be use?

5 Answers   Cap Gemini,


How do u set a default value to a column if the column value is NULL?

7 Answers   HP,


Hai..,This Kiran . how to immlement SCD's through sequential file.please explain briefly.if nt ask me i will explain ,what i know.

2 Answers  


I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empname, company1,company2 as Ram, TCS,IBM in the target. How?

6 Answers   Cap Gemini,


Categories