Hi guys,
please design job for this,
MY INPUT IS
COMPANY,LOCATION
IBM,CHENNAI
IBM,HYDRABAD
IBM,PUNE
IBM,BANGLOORE
TCS,CHENNAI
TCS,MUMBAI
TCS,BANGLOORE
WIPRO,HYDRABAD
WIPRO,CHENNAI
HSBC,PUNE
MY OUTPUT IS
COMPANY,LOCATION,COUNT
IBM,chennai,hydrabad,pune,banglore,4
TCS,chennai,mumbai,bangloore,3
WIPRO,hydrabad,chennai,2
HSBC,pune,1
Thanks
Answer Posted / ankit gosain
Hi All,
Create a job design like below:
SeqFile--->SortStage--->Transformer--->RemoveDup--->SeqFile
Steps:
-----
1. At sort stage, take sort key = Company and sort key mode
= Don't sort (Previously Grouped) & take a
CreateClusterKeyChange column.
2. At Transformer Stage, create two stage variables:
temp of integer type with 0 as default,
temp1 of varchar type.
now, write in their derivation:
if clusterKeyChange=1 then 1 else temp+1----temp
if clusterKeyChange=1 then Location else temp1:',':Location-
---temp1
Create one o/p column (say count).
Now derive the o/p derivation columns as:
Company--------Company
temp1----------Location
temp-----------Count
3. At remove duplicate stage, take key=Company and
Duplicate to retain = Last
now just drag and drop the i/p columns to o/p derivation
& you will get the desired result.
For further queries, mail me on ankitgosain@gmail.com
Cheers,
Ankit :)
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
Have you have ever worked in unix environment and why it is useful in datastage?
Difference between in process and inter process?
Difference between ‘validated ok’ and ‘compiled’ in data stage?
Can anyone tell me a difficult situation who have handled while creating Datastage jobs?
What are the different options associated with dsjob command?
How can one find bugs in job sequence?
What are the partitioning techniques available in link partitioner?
Define Job control?
What are the different type of jobs in datastage?
What are datastage sequences?
What is the flow of loading data into fact & dimensional tables?
What are routines in datastage? Enlist various types of routines.
Which commands are used to import and export the datastage jobs?
What is aggtorec restructure operator?
Triggers,VIEW,Procedures