Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


souce file having the columns like
name company
krish IBM
pooja TCS
nandini WIPRO
krish IBM
pooja TCS
if first row will be repeat i want the result like this
name company count
krish IBM 1
pooja TCS 1
nandini WIPRO 1
krish IBM 2
pooja TCS 2


Answers were Sorted based on User's Feedback



souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / disney

first sort the both name and compamy and then,
using stage variable in transformer:
curr= name:company
val=if curr <> prev then 1 else val+1
prev=curr

o.p = val
name,company,val

Is This Answer Correct ?    6 Yes 2 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / ankit gosain

Hi ALL,

Job Design:

SourceSeqFile--->SortStage--->Transformer--->TgtSeqFile

1. In Sort Stage, take two key, name & company and then go
to options and create a keyChange column.
2. In transformer stage, create a stage variable of integer
type (say Var1) and write in it's derivation:
if keyChange=1 then 1 else Var1+1
3. Now create a new column in tgt (say count) and in
transformer, assign that Var1 to the derivation of count.
4. Goto o/p tab of transformer and there sort the data on
count column.
You'll get the desired output.

If you have more queries, you can mail me on
ankitgosain@gmail.com

Cheers,
Ankit :)

Is This Answer Correct ?    3 Yes 0 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / shasank, pr3systems

use transforemr stage and give three stage variable with intial value as 0,
then give (if company=ibm then count=count+1 else stgvar1)
like give three conditions for remaing two companies in two stage variables)
and in column derivation give if company=ibm then stgvar1 else
if company=wipro then stgvar2 else if company=tcs then stgvar3 else 0(company not in list)

Is This Answer Correct ?    7 Yes 5 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / pushparaj

Just modified the last post with minor changes

First sort the both name and compamy and then,
using stage variable in transformer:
sv1= name:company
sv3=if sv1=sv2 then sv3+1 else sv3(initial value of sv3=1)
sv2=sv1(initial value of sv2 =XXXXXXX)

OP

name company count=sv3

Is This Answer Correct ?    3 Yes 2 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / srinivas

Use below stage variables

create 4 stage variables

STG1 =NAME:COMPANY

STG2=1

STG3= IF STG1:STG4 THEN STG3+1 ELSE STG2

STG4= STG1

create extra column for store this ranks.


After this stage use the sort stage to sort the data based on ranking column.

Then will get the exact output what we are looking.

krish IBM 1
pooja TCS 1
nandini WIPRO 1
krish IBM 2
pooja TCS 2

Is This Answer Correct ?    1 Yes 0 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / sankar

use aggregator stage take count(*) group by name

Is This Answer Correct ?    1 Yes 0 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / abc

we can use aggregator stage.. nad group on the basis of name and company...

Is This Answer Correct ?    0 Yes 0 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / anand

we can use aggregator stage to count the repeated records and WHERE AGGREGATION TYPE:COUNT ROWS

Is This Answer Correct ?    0 Yes 0 No

souce file having the columns like name company krish IBM pooja TCS nandini WIPRO krish IBM p..

Answer / reddymkl.dwh

SeqFile---->Sort---->Trms---->Dataset

Sort_Stage: Key=Company (Or) Name

Trms
----------

SV=Company
SV1= If dslink.Company=SV Then SV+1 Else 1

Add (count) column in Transformer stage
Map SV1 stage variable to Count column (SV1=Count)

Will get desired output..

Plz correct me if am wrong....

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Stage Interview Questions

How many Nodes configuration file you used in your last project?

1 Answers  


explain how to create SCD-2 IN DATASTAGE 7.5X2 PLZ EXPLAIN WITH 4 OR 5 RECORDS TAKE IT EXAMPLE AND JOB DESINGN URGENT

3 Answers   IBM, Polaris,


What is the Environment Variable need to Set to TRIM in Project Level?(In transfermer, we TRIM function but I need to impliment this project level using Environment variable)

0 Answers   IBM,


How to add zero "0" before record in a field?

4 Answers  


CHANGE CAPTURE

0 Answers   CTS,


Explain the datastage parallel extender (px) or enterprise edition (ee)?

0 Answers  


What are the components of datastage?

0 Answers  


for example You have One Table with 4 Columns (Mgr ID, Department ID, Salary, Employee ID). Can you find out the Average Salary and Number of Employee present per Department and Mgr

0 Answers  


what is A Datastage?

2 Answers  


what is the best stage in datastage parller jobs to use full out join and why

5 Answers   Virtusa,


1.How do u handle NULL in sequential stage. 2.Difference between switch stage and filter stage.

4 Answers  


Define APT_CONFIG in Datastage?

0 Answers  


Categories