STAT=5 means the program is trying to add a person with the same number as another person. It should never try to do that, because it knows the highest number in use at all times.
Run the Quality check on your database, and try it again with a new directory.
Stat=5 means something is the same that should not be the same, such as the BK code number or the marriage number in the marriage file, or the location number in the location file, etc.
A "key" is a field that is used to index a record. For the BKPERSON file, there are 5 "keys" The main key is the BK code number. This must be unique. If the program tries to add two people with the same number, you will get STAT=5 because I have set up the BK code number to be a unique key. Some other keys are the name, and the Ref Number, but those keys are not unique and it will not cause error 5 if two have the same key for those fields.