Date Logic
Posted: Mon Mar 23, 2009 10:25 am
Hi,
I've requirement like the following,
I've a key field,if the value of key fileds are same for more than one record then we should check the date1 & date2 of both records,if the date1 value of the second record is one day greater than date2 of first record then both these records are merged to form a single record.Else if the date1 value of the second record more than one day greater than date2 of first record then both these records should be returned as two records,
The input & expected output are as follows,(Date values are given in dd/mm/yyyy format)
INPUT:
KEY Date1 Date2
A 1/1/2008 1/6/2008
A 1/7/2008 31/12/2008
B 1/1/2008 1/6/2008
B 1/7/2008 31/12/2008
C 1/1/2008 1/6/2008
C 1/7/2008 31/12/2008
C 1/2/2009 6/8/2009
OUTPUT:
KEY Date1 Date2
A 1/1/2008 31/12/2008
B 1/1/2008 1/6/2008
B 1/7/2008 31/12/2008
C 1/1/2008 31/12/2008
C 1/2/2009 6/8/2009
How to achieve it datastage.
Thanks in Advance.
[/u][/b]
I've requirement like the following,
I've a key field,if the value of key fileds are same for more than one record then we should check the date1 & date2 of both records,if the date1 value of the second record is one day greater than date2 of first record then both these records are merged to form a single record.Else if the date1 value of the second record more than one day greater than date2 of first record then both these records should be returned as two records,
The input & expected output are as follows,(Date values are given in dd/mm/yyyy format)
INPUT:
KEY Date1 Date2
A 1/1/2008 1/6/2008
A 1/7/2008 31/12/2008
B 1/1/2008 1/6/2008
B 1/7/2008 31/12/2008
C 1/1/2008 1/6/2008
C 1/7/2008 31/12/2008
C 1/2/2009 6/8/2009
OUTPUT:
KEY Date1 Date2
A 1/1/2008 31/12/2008
B 1/1/2008 1/6/2008
B 1/7/2008 31/12/2008
C 1/1/2008 31/12/2008
C 1/2/2009 6/8/2009
How to achieve it datastage.
Thanks in Advance.
[/u][/b]