24
1. I have a file having CITY column having 100 records I want the Target as First letter starts with “A” and “B” and Remaining records as a rejected output. 2. I have a source file like this I want out put as like Source file Target1 10 10 20 20 10 30 10 Target2 10 10 20 10 10 30 20 3. I have a source file like this I want out put as like Source file Target1 10 10 20 20 10 10 Target2 10 30 20 30 4. I have a source file like this I want out put as like Source file Target1 10 10 20 20 10 10 10 10 10 20 20 Target2 30 30

Datastage Scenarios in indian

Embed Size (px)

DESCRIPTION

This document will make you perfect if you finish this scenarios.

Citation preview

Page 1: Datastage Scenarios in indian

1. I have a file having CITY column having 100 records I want the Target as First letter starts with “A” and “B” and Remaining records as a rejected output.

2. I have a source file like this I want out put as likeSource file Target110 1020 2010 3010 Target210 1020 10

1030 20

3. I have a source file like this I want out put as likeSource file Target110 1020 201010 Target210 302030

4. I have a source file like this I want out put as likeSource file Target110 1020 2010 1010 1010 2020 Target230 30

Page 2: Datastage Scenarios in indian

5. I have a source file like this I want out put as like without using link petitioner Source file Target11 12 43 74 Target25 26 57 88 Target39 3

66. I have a source file like this I want out put as like without using link petitioner

Source file Target112 even records34 Target256 odd records789

7. I want the count of the Each department number with out using Aggregator Source File: Target

DEPTNO, SAL Count

10, 1000 110, 1100 210, 1200 320, 1100 120, 1200 230, 1200 130, 1300 230, 1400 3

Page 3: Datastage Scenarios in indian

8. I want the sum of the Each department number salary with out using Aggregator Source File: Target

DEPTNO, SAL Count

10, 1000 100010, 1100 210010, 1200 330020, 1100 110020, 1200 230030, 1200 120030, 1300 250030, 1400 3900

9. I want the count of Each Deptno and Avg sal for Each Deptno using Aggregator10. I want the count of the Each department number

Source File: Target

DEPTNO, SAL Deptno, Sum_Sal

10, 1000 10, 330010, 1100 20, 230010, 1200 30, 390020, 110020, 120030, 120030, 130030, 1400

11. Find The Output With out PIVOTE stageSource File: TargetSNO, MATHS, PHYSICS, CHEMISTRY SNO, MARKS101, 70, 80, 90 101, 70102, 65, 55, 75 101, 80

101, 90102, 65102, 55102, 75

Page 4: Datastage Scenarios in indian

12.Source: TargetEMPNO, SAL Empno,jan,feb,mar,april101, 1000 101, 1000, 1100, 1000, 10000101, 1100 102, 1100, 1300, 1200, 1500

101, 1000101, 10000102, 1100102, 1300102, 1200102, 1500

13.Source File: TargetEMPNO, SAL Empno, Format101, 1000 101, 1000101, 1100 101, 1000, 1100101, 1000 101, 1000, 1100, 1000101, 10000 101, 1000, 1100, 1000, 10000102, 1100 102, 1100102, 1300 102, 1100, 1300102, 1200 102, 1100, 1300, 1200102, 1500 102, 1100, 1300, 1200, 1500

14.Source File: Target1: DEPTNO, SAL How to Capture Third Duplicate

10, 1000 from Each Deptno?10, 110010, 1200 Target2:20, 1100 Remaining records as a Rejected 20, 1200 output30, 120030, 1300

Page 5: Datastage Scenarios in indian

30, 1400

15.Source File: TargetDEPTNO, SAL Deptno,count,padding,padding10, 1000 10,1,00001000,001010, 1100 10,2,00001100,001010, 1200 10,3,00001200,001020, 1100 20,1,00001100,002020, 1200 20,2,00001200,002030, 1200 30,1,00001200,003030, 1300 30,2,00001300,003030, 1400 30,3,00001400,0030

16.Source File: TargetDEPTNO, SAL Deptno,count,sum_Sal,padding10, 1000 10,1,1000,001010, 1100 10,2,2100,001010, 1200 10,3,3300,001020, 1100 20,1,1100,002020, 1200 20,2,2300,002030, 1200 30,1,1200,003030, 1300 30,2,2500,003030, 1400 30,3,3900,0030

17.Source File: TargetEmpno, Ename, Date Empno, Ename, Date100, sudheer, 2010-1-5 100, sudheer, 2010-01-05101, kumar, 2010-10-2 101, kumar, 2010-10-02103, lsk, 2010-1-2 103, lsk, 2010-01-02

18.Source File: TargetEmpno, Ename, Date Empno, Ename, Date100, sudheer, 2010-01-05 100, sudheer, 2010-1-5

Page 6: Datastage Scenarios in indian

101, kumar, 2010-10-02 101, kumar, 2010-10-2103, lsk, 2010-01-02 103, lsk, 2010-1-2

19.Source File: Target

Empno, Ename, Email Empno, Ename, Email100, sudheer, [email protected] 100, sudheer, sudheer101, kumar, [email protected] 101, kumar, lsk.4a4102, lsk, [email protected] 102, lsk, sudheer.4a4

20. I want the out put like this Source File Target FileEMPNO, ENAME, MGRNAME EMPNO, ENAME, MGRNAME101, Siva, Thiru 101, Shiva,Thiru,Gandhi102, Thiru, Gandhi 102, Thiru, Gandhi, Gandhi

21. I want the out put like this Source File TargetFile1 File2 File3 File1 count File2 count File3 count1 11 25 1 1 11 1 25 1 2 12 26 2 2 12 2 26 23 13 27 3 3 13 3 27 3: : : : : : : : :: : : : : : : : :10 25 40 10 10 25 15 40 15

22. I want the out put like this Source File TargetEmpno, Ename, Detno,Sal, City File1

City name starts with “A”File2

Empno, Ename, Deptno, Max_Sal, CityFile3

<>File1 and <>File 2

23. In my Target, I have 10 records but I want to store only one record. (Ex: 5th Record)

Page 7: Datastage Scenarios in indian

24. I want the out put like this

Source File:

Year q1sales q2sales q3sales q4sales

2000 8000 9000 7000 6000

2001 4000 5000 2000 3000

2002 1000 2000 4000 8000

Target:

2001 2002 2003

q1 q1 q1

q2 q2 q2

q3 q3 q3

q4 q4 q4

25. I have a sequential file stage and transformer after that the data is going to target as : containing name start with “s”

Source File:

Empno, Ename, Sal, Deptno

100, sudheer, 1000, 10

101, kumar, 5000, 10

Page 8: Datastage Scenarios in indian

102, sudha, 2000, 20

103, manu, 6000, 30

104, suresh, 10245, 40

26.

Source File Target

Eid Ename Format

1 A 1-A,B,C

1 B

1 C

2 D 2-D,F

3 E 3-E

2 F

27.

Source File Target

Eid Ename Format

1 A 1-A

1 B

1 C

2 D 2-D

3 E 3-E

2 F

28.

Source File

Page 9: Datastage Scenarios in indian

Chaar

sudheer

kumar

lak

manu

madhu

manoj

29.

Source File o/p:target

a 3 a a a

b 4 b b b b

c 5 c c c c c

30.

Source File Target:

Jan Feb Mar

1 2 3 Jan=11

4 5 5 Feb=11

6 4 5 Mar=13

31.

Source Target

Calname-varchar Calname-varchar

mphasis MphasiS

satyam SatyaM

techmahindra TechmahindrA

wipro WiprO

ibm IbM

Page 10: Datastage Scenarios in indian

32. My source file is sequential file,in sequential file records is a,b,c,d,1,2,3.The expected output is abcd,1

abcd,2

abcd,3

33. In my Source File:

a,b,c,d

x,y,t,l

Here a,b,c,d are columns and x,y,t,l are data in them.

Now I want in this place of “t” the value as “p”.Do it in datastage and unix

34. I/p source O/p target ------------ -------------cid, acc1, acc2, amou1, amou2 1target: 10, SBI, 1000010, SBI, ICICI, 10000, 20000 2target: 10, ICICI, 20000

35. I have file like this

i/pName, seq, descDWH, 02, wareDWH, 01, dataDWH, 03, houseTCS, 01, TataTCS, 03, servicesTCS, 02, consultancy and I want the output like thisTCS Tataconsultancy servicesDWS Dataware house

36.

Sourec File Target

Phdetails phddetails

Page 11: Datastage Scenarios in indian

3129985603912 312-9985603912

254625621365 254-625621365

123456789 123456789

37.

Sourec File Target

Phdetails phdcode phdnumber

312-9985603912 312 9985603912

2546-25621365 2546 25621365

123456789 000 123456789

38. How to Remove The 3rd Record From Source usung source file Stage?

39. Create a datastage job for following output.(with out any warning or fatal error).

SOURCE: TARGET:

EMPNO DEPTNO DEPTNO COUNT

100 10 10 2101 20 20 3102 30 30 2103 20104 20105 30106 10

40. Create a datastage job for increasing the employee salary (i.e., 10% increment for deptno=10, 12.5% for deptno=20 and 14.25% for deptno=30).

41. Create a datastage job for following output. (with out using Transformer)Source having 5 records, target 3files also should have 5 records.

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

Page 12: Datastage Scenarios in indian

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

TARGET1: TARGET2: TARGET3:

1file 2file 3file

EMPNO DEPTNO EMPNO MGR EMPNO HIREDATE

100 10 100 101 100 10-JAN-1999

101 20 101 102 101 22-JUL-1997

102 30 102 103 102 16-AUG-1996

103 20 103 104 103 05-DEC-1995

104 30 104 NULL 104 30-OCT-1992

42. Create a datastage job for getting unique records to target.SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

103 20 104 06-DEC-1995

100 10 101 12-JAN-1999

Here EMPNO is key column (observe hiredate)

TARGET:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

43. Create a datastage job for getting unique records to target.

Page 13: Datastage Scenarios in indian

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

103 20 104 06-DEC-1995

100 10 101 12-JAN-1999

Here EMPNO is key column (observe hiredate)

TARGET:

EMPNO DEPTNO MGR HIREDATE

100 10 101 12-JAN-1999

101 20 102 22-JUL-1997

102 30 103 17-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

44. Create a datastage job for create sequence numbers. ( From 234)

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

TARGET:

SEQNO EMPNO DEPTNO MGR HIREDATE

234 100 10 101 10-JAN-1999

235 101 20 102 22-JUL-1997

236 102 30 103 16-AUG-1996

237 103 20 104 05-DEC-1995

238 104 30 NULL 30-OCT-1992

45. Create a datastage job for create sequence numbers. ( From 345 increment by 10)

Page 14: Datastage Scenarios in indian

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

TARGET:

SEQNO EMPNO DEPTNO MGR HIREDATE

345 100 10 101 10-JAN-1999

355 101 20 102 22-JUL-1997

365 102 30 103 16-AUG-1996

375 103 20 104 05-DEC-1995

385 104 30 NULL 30-OCT-1992

46. Create a datastage job for separate the employees by deptno.(with out using Transformer). (create multiple jobs with different stages)

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

103 20 104 06-DEC-1995

100 10 101 12-JAN-1999

TARGET10:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

100 10 101 12-JAN-1999

TARGET20:

EMPNO DEPTNO MGR HIREDATE

101 20 102 22-JUL-1997

103 20 104 05-DEC-1995

Page 15: Datastage Scenarios in indian

103 20 104 06-DEC-1995

TARGET30:

EMPNO DEPTNO MGR HIREDATE

102 30 103 16-AUG-1996

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

47. Create a datastage job for arranging ascending and descending order of employees by their respective deptno.

SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

103 20 104 06-DEC-1995

100 10 101 12-JAN-1999

TARGET asc:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

100 10 101 12-JAN-1999

101 20 102 22-JUL-1997

103 20 104 05-DEC-1995

103 20 104 06-DEC-1995

102 30 103 16-AUG-1996

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

TARGET desc:

EMPNO DEPTNO MGR HIREDATE

102 30 103 16-AUG-1996

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

101 20 102 22-JUL-1997

Page 16: Datastage Scenarios in indian

103 20 104 05-DEC-1995

103 20 104 06-DEC-1995

100 10 101 10-JAN-1999

100 10 101 12-JAN-1999

48. Create a datastage job for get the following target. (create multiple jobs using different stages)

SOURCE 2 TABLES EMP, DEPT

EMP SOURCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

101 20 102 22-JUL-1997

102 30 103 16-AUG-1996

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

108 60 109 10-JAN-2009

DEPT SOURCE:

DEPTNO DEPTNAME

10 SALES

20 FINANCIAL

30 TELECOM

40 BANKING

50 HEALTH

TARGET:

EMPNO DEPTNO DEPTNAME

100 10 SALES

101 20 FINANCIAL

102 30 TELECOM

103 20 FINANCIAL

104 30 TELECOM

108 60 NULL

49. Create a datastage job for generating 50 records(rows).Each row should have 2 columns like

NO NAME

10 GNAN

Page 17: Datastage Scenarios in indian

11 GNAN 12 GNAN13 GNAN14 …………………

50. Create a datastage job for extract only 10 records from the source ( source have 100 records)(create multiple jobs using different stages)

51. Create a datastage job for decrement the salaries of emp by 5% whose deptno not in the DEPT table.

52. Create a datastage job for combining the data from more than 2 files.SOURCE10:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

100 10 101 12-JAN-1999

SORUCE20:

EMPNO DEPTNO MGR HIREDATE

101 20 102 22-JUL-1997

103 20 104 05-DEC-1995

103 20 104 06-DEC-1995

SORUCE30:

EMPNO DEPTNO MGR HIREDATE

102 30 103 16-AUG-1996

104 30 NULL 30-OCT-1992

102 30 103 17-AUG-1996

TARGET:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

100 10 101 12-JAN-1999

101 20 102 22-JUL-1997

103 20 104 05-DEC-1995

103 20 104 06-DEC-1995

102 30 103 16-AUG-1996

104 30 NULL 30-OCT-1992

Page 18: Datastage Scenarios in indian

102 30 103 17-AUG-1996

53. Create a datastage job for following output

SORUCE:

EMPNO DEPTNO MGR HIREDATE

100 10 101 10-JAN-1999

103 20 104 05-DEC-1995

104 30 NULL 30-OCT-1992

TARGET: (single column)

EMPNO+DEPTNO+MGR+HIREDATE

100+10+101+10-JAN-1999

103+20+104+05-DEC-1995

104+30+NULL+30-OCT-1992

54. Create a datastage job for following output by using following source

SORUCE: (single column)

EMPNO+DEPTNO+MGR+HIREDATE

100+10+101+10-JAN-1999

103+20+104+05-DEC-1995

104+30+NULL+30-OCT-1992

TARGET:

EMPNO MGR

100 101

103 104

104 NULL

55 . Create a sequence job for above 55a and 55b jobs. For 55a job input is 55b job output.

56. Create a datastage job for compare two datasets and observe new record, update record and delete record.

Before Dataset:

SSN NAME ADDRESS

A123 John Boston, US

Page 19: Datastage Scenarios in indian

B234 Michael Minneapolis, US

C345 Smith Michigan, US

D456 Clark New York, US

After Dataset:

SSN NAME ADDRESS

A123 John New jersy, US

B234 Michael Minneapolis, US

D456 Clark New York, US

E567 Gnan Mumbai, IND

F678 Ganesh Hyderabad, IND

57. Create a datastage job for extract only last 10 records from the source (source have 100 records)

58. If I want information in a separate file for your job name, invocation id, job start date time, host, project name. How will you do this?

59. Source file/table having 1 Lakh records. I want to write 10% of these records into separate file/table (with out using transformer). How will you do this?