Help with Logic - How to split the records into groups
Posted: Mon Jul 16, 2012 8:40 am
Hi All,
I am coding for a requirement where I need to split the input records based on the no:of records with the same value for a Field A. When the no: of records with the same key value exceeds 6, then it needs to split into 2 groups & assign a new group value.
That is, if the no: of records with the same key field A is more than 6, the whole record group should be split into multiple groups.
e.gs:
if the no: of records with the same key field A is 6, then 6 (Same Field A value)
if the no: of records with the same key field A is 7, then 5 +2 (Assign a new value for Field A for the 2 recs)
if the no: of records with the same key field A is 8, then 5+3 (Assign a new value for Field A for the 3 recs)
if the no: of records with the same key field A is 10, then 5+5 (Assign a new value for Field A for the new 5 recs)
if the no: of records with the same key field A is 11, then 5+6 (Assign a new value for Field A for the 6 recs)
If the no: of records with the same key field A is 12, then 5+5+2 (Assign new values for Field A for the new 5 & 2 recs)
Can somebody help me by sharing some thoughts on how to accomplish this in DataStage.
Thanks Much
Freddie
I am coding for a requirement where I need to split the input records based on the no:of records with the same value for a Field A. When the no: of records with the same key value exceeds 6, then it needs to split into 2 groups & assign a new group value.
That is, if the no: of records with the same key field A is more than 6, the whole record group should be split into multiple groups.
e.gs:
if the no: of records with the same key field A is 6, then 6 (Same Field A value)
if the no: of records with the same key field A is 7, then 5 +2 (Assign a new value for Field A for the 2 recs)
if the no: of records with the same key field A is 8, then 5+3 (Assign a new value for Field A for the 3 recs)
if the no: of records with the same key field A is 10, then 5+5 (Assign a new value for Field A for the new 5 recs)
if the no: of records with the same key field A is 11, then 5+6 (Assign a new value for Field A for the 6 recs)
If the no: of records with the same key field A is 12, then 5+5+2 (Assign new values for Field A for the new 5 & 2 recs)
Can somebody help me by sharing some thoughts on how to accomplish this in DataStage.
Thanks Much
Freddie