Compute proportion for big data

Suppose a telecommunications company stores the data of customer phone charges in a binary file TelBill. Please compute the proportion of monthly call charge in the total phone charges for each customer.


1 =file("TelBill")
2 =A1.cursor@b()
3 =A2.groupx(ID;sum(Amount):Total;200)
4 =A1.cursor@b()
5 =A4.sortx(ID)
6 =join@x(A5:TelBill,ID;A3:Sum,ID)
8 =A7.fetch(200)
9 >A7.close()

To compute the proportion regarding the big data, firstly, compute the total call charge of each customer. If there is too much data to be held in the TSeq, use the cursor, then align and join the data in the cursors.

In A8, only the first 200 results are retrieved, as shown below: