I´ve sequential file which contains for example following record:

100,23,2
100,24,1
101,25,4
102,23,4
103,23,4
103,35,5

First is customer number 100 then is the number of the buyed product (23) and the last one is the measure of buyed products (2).

I must read all records and print every customers total amount. (I´ve random access file which contains product information)

This is what I´ve tryed. I know that this is nearly right what I´m doing but the problem is in "input" places PS. I can´t use tables.

Do While Not EOF(1)

Input #1, customernumber, productnumber, piecessold
formercustomer = customernumber
sum = 0

Do While formercustomer = customernumber And Not EOF(1)
Get #2, productnumber, product
sum = sum + product.price * piecessold
Input #1, customernumber, productnumber,piecessold

Loop

Print sum
Loop