Solution

This is the solution to the random access file problem.