Last time I posted a topic "Count number of volume and cylinders of each DASD" which according to forum veteran was ambiguous topic ( I accept it). So I am starting new topic which I believe is straight forward (hope so )
My requirement is to count each unique record and sum its associated value for example,
AAAA 20
BBBB 10
BBBB 4
BBBB 1600
BBBB 33
CCCC 5
CCCC 9
CCCC 12
DDDD 13
DDDD 14
If above is my input, my output should be
RECORD COUNT SUM
AAAA 1 20
BBBB 4 1647
CCCC 3 26
DDDD 2 27
I know this can be done easily with SORT (though I don't know the exact syntax) but I am finding a way to do it with REXX. So far, I am only able to count the unique number of records (which is 4 in this case but not each unique record)
count = 0
DO j = 1 to i-1
k = j + 1
if (serial.j == serial.k) then iterate
else count = count + 1
END
say count
DO j = 1 to i-1
k = j + 1
if (serial.j == serial.k) then iterate
else count = count + 1
END
say count
I started with Akatsukami suggestion by sorting the records first, but no luck after than. Sorry for making this long, but any help would be really appreciated. Help this poor beginner who wants to learn.