Brainer's solution will work, if you are using streams... but you're using standard Pascal file handling from what I can see, so this is how you do it...

When you create the file, you open it with 'rewrite'. This creates the file everytime. When you want to edit a record or just read the data in the file, you open the file with 'reset' and then use 'seek' to find the record you want based on it's record number.

There are other routines which you may find useful... 'filepos' returns the current record number, 'filesize' returns the total number of records in the file. Record indices start at 0 for the first record.

When you want to edit a record, you use 'seek' to get to the record you want to edit, then read it using 'read'. Make the changes to the record in memory, then move back to it (remember 'read' advances the files record pointer) using 'seek' and then simply 'write' the record back.

So, the first time you open the file use 'rewrite' to create it. The next time, check if it exists using 'fileexists' and if it does, open it with 'reset'. If you want to add a new record, remember to go to the end of the file using something like 'seek(f,filesize(f))'.

These are the standard file handling commands for real Pascal files... there are others but these are for specific file types ('append' for example is only for use with text files).