ObjectScript provides several commands to help ensure database integrity: Lock, TStart, and TCommit. We'll cover these in preparation for adding editing capabilities to the lookup routine. These three commands usually appear near each other. In general, you should use them in this way:
Select a record for editing.
Lock the record.
Get the updated data for the record.
TStart a transaction.
Store the new data.
TCommit the transaction.
UnLock the record.
You use the Lock command to prevent multiple processes from updating the same record at the same time. But it only works by convention: all the code throughout an application that updates a given global must try to Lock the record that is to be updated, and unLock it when finished. If one routine uses Lock, but another doesn't, nothing prevents the second routine from updating the record while the first routine has it locked.
You use the TStart and TCommit commands to protect database transactions. A transaction is simply a series of Set and/or Kill commands on the database. You need to ensure that an entire transaction completes, or that none of it completes. This guarantees that all the globals in a transaction (for both data and indices, for example) remain in sync.