The READ ONLY command may be used to set a table (or all tables) so that no changes may be made to existing records, including deletion.
Furthermore, this command can prevent you from inadvertently locking records. There are many commands in the 4D language that can load, and subsequently lock, a record. For example, the ALL RECORDS command will load and lock the first record in the selection.
In general, unless your code is making changes to existing records in a given table, it is best to set that table to read only until such time as changes need to be made (use the READ WRITE command to make the table write-able).
One of the useful techniques in troubleshooting code that is not supposed to save changes to a table is to enter the table name in the Expressions section of the debug window. Expand the tree view to reveal the current number of the locked records in the table. To prevent such issues, use the READ ONLY or READ WRITE commands in the appropriate situation.
Documentation for READ ONLY:
Documentation for READ WRITE: