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?

Answers were Sorted based on User's Feedback



I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / subhash

The Simple way is:
SRCFile---->PIVOT Stage---->TGT
1. in PIVOT stage, select vertical PIVOT option.
2. specify the 'Array Size' as 2
3. select the 'Group by' check box for 'empname'
4. select the 'Pivot' check box for 'company'
then u will get the desired output.

Is This Answer Correct ?    11 Yes 1 No

I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / venkatesh

The flow will be like this

src----->sorter---->transformer----->remove duplicates---->trg
SORTER
in sorter sort by the key=empname and create keychange column

TRANSFORMER
create two stage variables stg1 and stg2
if key change=1 then company else stg2 :',': company |stg1
_____________________________________________________|_____
|
stg1 |stg2

connect the stg1 as out put column and empname as output

from transformer connect to the remove duplicates
REMOVE DUPLICATES
key=empname
duplicates to retain=last
connect to the trg

u will get the output

Is This Answer Correct ?    5 Yes 1 No

I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / cgi

Take sequential file and use sort stage and set keychange
column=true,put filter to output the data to two links, one
is kechange is 0 and other is for 1. first link is directly
goes to join stage and other stage should go to copy
stage.In the copy stage change the company column name to
company2 and populate to join. in the join stage provide
the key column to 'name' and do inner join. u will get
output as required.

Is This Answer Correct ?    0 Yes 2 No

I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / tina

Use a lookup stage after the file. Do a self-lookup on this
file on empname. When the empname matches, take the empname
and company1 from stream link and company2 from reference
link and map to the target.

Is This Answer Correct ?    1 Yes 4 No

I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / vinod upputuri

Venkatesh is Absolutely right but unfinished. After remove
duplicate stage we have to use either column import stage or
transformer stage.

SEQ>>>TRANS>>>REMOVEDUPLICATE>>>COLUMNIMPORT/TRANSFORMER>>>TARGET

if Transformer: use field function in derivation

for company1: field(company,',',1)
company2: filed(company,',',2)

for column import stage: specify the key column: company
default delimeter: ','
columns: company1 and company2

Is This Answer Correct ?    0 Yes 3 No

I have a file it contain 2 records like empname,company as Ram, Tcs and Ram, IBM. But i want empna..

Answer / murali

Take the seq file stage and transformer and data set. in
transformer stage take two stage variables st1,st2 set the
intial value as '0' and data type is 'varchar' for st1
in st2 by using concatenate st1:',':st2

Is This Answer Correct ?    0 Yes 12 No

Post New Answer

More Data Stage Interview Questions

What is lookup table?

5 Answers  


How to write a expression to display the first letter in Caps in each word using transformer stage ? Please let me know ASAP Thanks in advance...

0 Answers   Alpharithm Technologies,


If seg file having 10 records ex:eid 1 2 " " 10 if oracle database having 100 records ex:eid 1 2 " " 100 how to delete matched records permenently from oracle database using datastage ?

5 Answers   Infotech,


How can we select pr retrieve the particular row in dataset by using orchadmin command?

1 Answers   IBM,


What is apt_config in datastage?

0 Answers  






how do u catch bad rows from OCI stage? And what CLI stands for?

0 Answers  


1)i put Pharma Project in my Resume..whar are the sources used in my project Generally? 2)how many fact and dimensional tables used? 3)Have u used any Datamarts and measues in fact table? ....plz give the answers...

2 Answers   iGate,


How rejected rows are managed in datastage?

0 Answers  


how can you generate sequence number using only the sequential file stage?

3 Answers   TIAA CREF,


what is the differeces between hash and modulus partition methods

4 Answers   TCS,


I have Seq file, I don't want 10, 11th(or any two records like 20, 30th records ) records in the output

6 Answers   TCS,


when U have a remove dublicate option in sort stage, why we have a remove dublicate stage in PX, thought it is recamended to sort data before using a remove dublicate stage. I hae been thinking this from days....

4 Answers   Target,


Categories