source has 2 fields like
COMPANY LOCATION
IBM HYD
TCS BAN
IBM CHE
HCL HYD
TCS CHE
IBM BAN
HCL BAN
HCL CHE
LIKE THIS.......
AND I WILL GET THE OUTPUT LIKE THIS....

Company loc count

TCS HYD 3
BAN
CHE
IBM HYD 3
BAN
CHE
HCL HYD 3
BAN
CHE

PLZ SEND ME ANSWER FOR THIS QUESTION..........

Answers were Sorted based on User's Feedback



source has 2 fields like COMPANY LOCATION IBM HYD TCS ..

Answer / solomon

2 ways to do it
1- input -> Transformer -> RDP-> output
Sort the input on location, company
do a comparison in Stage Variable with prev record and keep incrementing a counter
pass it via Remove duplicate stage to retain unique records
2- input-> copy-> agrregator-> lookup-> RDP -> output
do the same as above using agg and lookup stage

Is This Answer Correct ?    1 Yes 0 No

source has 2 fields like COMPANY LOCATION IBM HYD TCS ..

Answer / sreepathi

Hi

Use stage variables in Transformer stage i.e IF THEN ELSE
IF ..condition comparing companies and use COUNT() function
in transformer for which field u want count

Is This Answer Correct ?    2 Yes 3 No

source has 2 fields like COMPANY LOCATION IBM HYD TCS ..

Answer / saibal kumar giri

Follow below steps-----
1.Read the data with sequential file or connector stage.
2.Use copy stage to streamline the data into two links
a.One data goes to lookup stage.
b.Second stream goes to aggregator stage.
3.In aggregator stage do a count(LOCATION) group by COMPANY.
you will be having data O/P from AGG as below
COMPANY COUNT
TCS 2
HCL 3
IBM 3
Use this output data as the reference link of lookup
stage.Where you have original source as master data.
4.Do a Inner join by lookup stage.
after lookup you will have data like
COMPANY:HCL LOCATION:HYD COUNT:3
COMPANY:HCL LOCATION:CHE COUNT:3
COMPANY:HCL LOCATION:BAN COUNT:3
COMPANY:IBM LOCATION:CHE COUNT:3
COMPANY:IBM LOCATION:BAN COUNT:3
COMPANY:IBM LOCATION:HYD COUNT:3
COMPANY:TCS LOCATION:BAN COUNT:2
COMPANY:TCS LOCATION:CHE COUNT:2
5.Then use a transformer stage along with stage variables
as below
SV1->link1.COMPANY
SV3-> if SV1=SV2 then SET NULL() else link1.COMPANY
SV2->SV1
Similarly for count also
Cheers!!!!!

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Data Stage Interview Questions

in sequtial file 2 columns avaliable,iwant only one column load the target how do it.

10 Answers   Wipro,


how to capture rejected data by using join stage not for lookup stage. please let me know

3 Answers   Satyam,


What is the difference between an operational datastage and a data warehouse?

0 Answers  


30 jobs are running in unix.i want to find out my job.how to do this?Give me command?

3 Answers  


What are the types of containers and how to create them?

0 Answers  






Can you define merge?

0 Answers  


Explain the ChangeApply stage?

11 Answers  


what is the difference between lookup stage reject link and merge stage reject link in datastage Parallel jobs? interm of output in Merge Reject link and Look Up Reject link ?

4 Answers   HCL,


What is a delta record? How you will read it?

0 Answers   EDS,


Source contains the metadata source ----- hyderabad,chennai,bangalore by using nested loop sequence select source as hyderabad in target just run target as hyderabad only not others please give me answer thanks in advance(give reply how to wrote logic using nested loop sequence)

1 Answers   IBM,


which cache supports connected & un connected Lookup

1 Answers   Wipro,


what is the main differences between Lookup, Join and Merge stages?

9 Answers   HCL,


Categories