| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== UNLOCK (unlock a locked data file) ====== | [[unload remove a called dll from memory .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[unlockthread unlock the current execution thread .htm|{{btn_next_n.gif|Next page}}]] | | || **UNLOCK(**//file//**)** {{blk2blue.jpg|blk2blue.jpg}} | **UNLOCK** | Unlocks a previously locked data file. | | //file// | The label of a FILE declaration. | The **UNLOCK** statement unlocks a previously LOCKed data file. It will not unlock a file locked by another user. If the //file// is not locked, or is locked by another user, UNLOCK is ignored. UNLOCK posts no errors. **Example:** **LOOP                 !Loop to avoid "deadly embrace"** ** LOCK(Master,1)      !Lock the master file, try for 1 second** ** IF ERRORCODE() = 32 !If someone else has it** **  CYCLE              !try again** ** END** ** LOCK(Detail,1)      !Lock the detail file, try for 1 second** ** IF ERRORCODE() = 32 !If someone else has it** ** ****UNLOCK****(Master)     !unlock the locked file** **  CYCLE              !try again** ** END    ** ** BREAK               !Break loop when both files are locked** **END** **See Also:** [[lock exclusive file access .htm|LOCK]]