# Retrieval and update locks

If any process, such as a TCL command or a FlashBASIC program
is executed from an account that does not have retrieval and/or update
privileges for a file, and then attempts to read and/or write to that
file, the process terminates with an error message indicating that
the file is access protected.

To read from or write to a retrieval/update protected
file, the retrieval and update lock codes must match those of the
file that is opened. This is a system function and cannot be accomplished
from FlashBASIC. If the file is retrieval protected, the file cannot
be opened and the program terminates.

## Example(s)

At TCL, message [210] above displays
if payroll is access protected.

```
list payroll
[210] File ’payroll’ is access protected.
```

If a file called payroll has an access retrieval lock
that does not match the lock codes (keys) for the current user, the
statement aborts the program with message [210].

```
file payroll
[210] in program ’enter-payroll’, File ’payroll’ is access protected.
```

If the file is access protected, the else clause is taken
and message [201] displays.

```
open ’payroll’ to payroll.file else stop 201,’payroll’
[201] ’payroll’ is not a file name.
```

## See also

- [create-account command](https://d3codex.com/tcl/create-account-command/)
- [File lock codes](https://d3codex.com/definitions/file-lock-codes/)
- [Locks](https://d3codex.com/definitions/locks-glossary/)
- [Retrieval locks](https://d3codex.com/pickbasic-flashbasic/retrieval-locks/)
- [retrieval-lock](https://d3codex.com/attributedefiningitem/retrieval-lock/)
- [ulk](https://d3codex.com/attributedefiningitem/ulk/)
- [users file](https://d3codex.com/systemfiles/users-file/)

---
Source: https://d3codex.com/definitions/retrieval-and-update-locks/ - part of the D3Codex reference.
