datastage job logic
Posted: Wed Jan 12, 2011 12:33 pm
Hi I want to develop a job,with the following req,
i/p 3 columns
id,date,price
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
2,06/01/2011,1000
3,12/01/2011,1000
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
assume my run date is 12/012011,
Now there are 3 cases I need to discuss,
case 1:
records with id=1 having dates as 05,06,07 and prices are 100,200,100 respectively,
since rundate is 12/01/2011,I need to generate the same ids those number of times in order to fill the date gap and price should be last available date price should be carried on
in this case
the output should be
id,date,price
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
1,08/01/2011,100
1,09/01/2011,100
1,10/01/2011,100
1,11/01/2011,100
1,12/01/2011,100
case 2:
records with id=2 having dates as 06/01/2011 and prices are 1000.
since rundate is 12/01/2011,I need to generate the same ids in order to fill the gap date and price should be last available date price should be carried on
in this case
the output should be
id,date,price
2,06/01/2011,1000
2,07/01/2011,1000
2,08/01/2011,1000
2,09/01/2011,1000
2,10/01/2011,1000
2,11/01/2011,1000
2,12/01/2011,1000
case 3:
records with id=3 having dates as 12/01/2011 and prices are 1000.
since rundate is 12/01/2011,I need not generate the ids in order to fill the date gap
in this case also as it is
the output should be
id,date,price
3,12/01/2011,1000
case 4:
records with id=4 having dates as 10/01/2011,11/01/2011,12/01/2011.
since rundate is 12/01/2011,I have dates till 12/01/2011 so no need to no need to fill any gap
in this case also as it is
the output should be
id,date,price
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
final output combining case1,case2,case3,case4 my output would be
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
1,08/01/2011,100
1,09/01/2011,100
1,10/01/2011,100
1,11/01/2011,100
1,12/01/2011,100
2,06/01/2011,1000
2,07/01/2011,1000
2,08/01/2011,1000
2,09/01/2011,1000
2,10/01/2011,1000
2,11/01/2011,1000
2,12/01/2011,1000
3,12/01/2011,1000
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
thanks in advance for the help
i/p 3 columns
id,date,price
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
2,06/01/2011,1000
3,12/01/2011,1000
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
assume my run date is 12/012011,
Now there are 3 cases I need to discuss,
case 1:
records with id=1 having dates as 05,06,07 and prices are 100,200,100 respectively,
since rundate is 12/01/2011,I need to generate the same ids those number of times in order to fill the date gap and price should be last available date price should be carried on
in this case
the output should be
id,date,price
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
1,08/01/2011,100
1,09/01/2011,100
1,10/01/2011,100
1,11/01/2011,100
1,12/01/2011,100
case 2:
records with id=2 having dates as 06/01/2011 and prices are 1000.
since rundate is 12/01/2011,I need to generate the same ids in order to fill the gap date and price should be last available date price should be carried on
in this case
the output should be
id,date,price
2,06/01/2011,1000
2,07/01/2011,1000
2,08/01/2011,1000
2,09/01/2011,1000
2,10/01/2011,1000
2,11/01/2011,1000
2,12/01/2011,1000
case 3:
records with id=3 having dates as 12/01/2011 and prices are 1000.
since rundate is 12/01/2011,I need not generate the ids in order to fill the date gap
in this case also as it is
the output should be
id,date,price
3,12/01/2011,1000
case 4:
records with id=4 having dates as 10/01/2011,11/01/2011,12/01/2011.
since rundate is 12/01/2011,I have dates till 12/01/2011 so no need to no need to fill any gap
in this case also as it is
the output should be
id,date,price
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
final output combining case1,case2,case3,case4 my output would be
1,05/01/2011,100
1,06/01/2011,200
1,07/01/2011,100
1,08/01/2011,100
1,09/01/2011,100
1,10/01/2011,100
1,11/01/2011,100
1,12/01/2011,100
2,06/01/2011,1000
2,07/01/2011,1000
2,08/01/2011,1000
2,09/01/2011,1000
2,10/01/2011,1000
2,11/01/2011,1000
2,12/01/2011,1000
3,12/01/2011,1000
4,10/01/2011,100
4,11/01/2011,200
4,12/01/2011,150
thanks in advance for the help