Student help--records, linked lists, sorting

Having an interest in this newsgroup for a few years, there are still
items that appear to be poorly covered by books and some instructors.
Some of these are addressed in this example program. Only the header
and main body are shown. Should anyone want the source code, send me
an email. <>

Program File_of_Records__Lists_And_Sorting;
{Turbo v6.0  1/15/01
    A file of records (which consist of a random 8 char name and
random age) is created. Seek is used to show the first and last record
in the file. These records are read to a queue type linked list,
sorted alphabetically by name and displayed. This list is now sorted
by decreasing age. It should be noticed that those of same age are in
alphabetic order. The heap is recovered and the option is given to
"APPEND" more records to the file and repeat the above.
    The file is erased before exiting the program.
    If you compile this program you will have about 280K more bytes in
the heap than if you run from the IDE. }

****************************** snip ************************

BEGIN  {main}
     memav := MemAvail; {original heap available}

     Write('The last record number is ', FileSize(fRec) - 1, ', ');
     Seek(fRec, FileSize(frec) - 1);   Read(fRec, single);
     Writeln(, ' ', single.age);

     Write('The first record number is 0, ');
     Seek(fRec, 0);    Read(fRec, single);
     Writeln(, ' ', single.age);

     FileToQueue(fRec, head, tail);

     Sort(head, ByName);
     Writeln('Alphabetically sorted:');

     Sort(head, ByAge);
     Writeln('Sorted by decreasing age:');

     Writeln('Original heap = ', memav, '  now: ', MemAvail);
     Write('More? (Any key/N) ');   Readln(ch);
Until UpCase(ch) = 'N';