Source Like
department_no, employee_name
----------------------------
20, R
10, A
10, D
20, P
10, B
10, C
20, Q
20, S

and Output should be like this

department_no, employee_list
--------------------------------
10, A
10, A,B
10, A,B,C
10, A,B,C,D
20, A,B,C,D,P
20, A,B,C,D,P,Q
20, A,B,C,D,P,Q,R
20, A,B,C,D,P,Q,R,S

Answers were Sorted based on User's Feedback



Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / subhash

small modification to the above ans:
SRC---->Transformer--->TGT
we do the 'HASH' partitioning on Dept_No.

SetNull value to the Stage variable----->SV_List

In the transformer stage variables:
SV_List :',' : Employee_Name ----->SV_List (Concatenating Employee
Names)

In the Column Derivation:
TRIM(SV_list, ',' , 'L')------->Employee_Name

Is This Answer Correct ?    5 Yes 1 No

Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / srinivas

By using the stage variables in transformer we can do this.

Before going to use transformer sort the data based on two columns.Order should be like below

Deptno Empname
10 A
10 B
SO ON...

After that in transformer take 3 stage varibles

stg1--->map the sorted Deptcolumn

stg2---> DSLink2.empname:',' (map the empname column and concatenate comma operator)

Stg2--->stg3:stg2 (concatenate first two staging varibles)


Then

In derivation of employee_list column (In transformer)

use below function

TRIM(stg3,',','T')---->employee_list (column derviarion)

It will gives you as expected result.

Thanks
Sri

Is This Answer Correct ?    5 Yes 3 No

Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / subhash

SRC---->Transformer--->TGT
we do the 'HASH' partitioning.

SetNull value to the Stage variable----->SV_List

In the transformer stage variables:
SV_List : Employee_Name ----->SV_List (Concatenating Employee
Names)

In the Column Derivation:
SV_list------->Employee_Name

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Data Stage Interview Questions

how many stages are there in Datastage... Please clarify mee??

3 Answers  


What is the default padding character?

3 Answers   IBM,


Hi am sundar, i have datas like 00023-1010 00086-1010 00184F2-1010 . . . . SCH-AS-1010 200-0196-039 . . . Now i want the result "SCH-AS" in onee column and "1010" in another column.. Can any one tell the answer...

5 Answers  


What is RCP?

2 Answers   TCS,


My input has a unique column-id with the values 10,20,30.....how can i get first record in one o/p file,last record in another o/p file and rest of the records in 3rd o/p file?

2 Answers   Wipro,


what is Audit table?Have u use audit table in ur project?

3 Answers   Accenture, Wipro,


if i have two tables table1 table2 1a 1a,b,c,d 1b 2a,b,c,d,e 1c 1d 2a 2b 2c 2d 2e how can i get data as same as in tables?chandu how can i implement scd typ1 and type2 in both server and in parallel?chandu field1 field2 field3 suresh , 10,324 , 355 , 1234 ram , 23,456 , 450 , 456 balu ,40,346,23 , 275, 5678 how to remove the ,inthe fields?

2 Answers  


Please tell me What is difference between 8.0 and 8.1

1 Answers   IBM,


what is 'reconsideration error' and how can i respond to this error and how to debug this

0 Answers   Wipro,


is it possible to access the same job by two users at a time in DataStage?

2 Answers   IBM,


How to display all the duplicate records from the oracle Table?

3 Answers   IBM,


i having source like emptable,dept table and combined purpose using for the join stage but join stage which partition techq will be prefored? pls given the ans?

2 Answers   Wipro,


Categories