I don't recommend using file lock flock() as this will prevent others from modifying the table while one user is adding a record. Additionally, if one user has a single record locked for modification the file lock will fail.
Instead use a header lock:
LOCK('0','mytable')
Secondly, I personally have had intermittent problems with append blank then replace. I think its much better practice to use SQL - Insert:
insert into mytable (pk,field1,field2) values (lnNewPK,lcField1,lcField2)
Just my 2cents.
Brandon Harker
Sebae Data Solutions