# unlock-item command

The unlock-item BASIC program clears
item locks that have not cleared through usual system operation.

Item locks are set by BASIC read statements
and other mechanisms, and provide a means of assuring data reliability
by preventing two processes from attempting to update the same item
at the same time.

The read statements (in
BASIC) that have a locking form set *item* locks only while working with an item. This means that two processes
can access items in the same group, provided they do not attempt to
update the same item. This is in contrast to early D3 systems, which
only set group locks on read statements.

A locked clause in read statements
allows a graceful means of dealing with the situation of attempting
to access a locked item. The program can take a special case and indicate
to the operator that they should try again later.

When a process
attempts to access an item that is locked, the screen freezes and
starts *beeping*. Usually, there is only a brief
wait until the item is unlocked, at which time the terminal stops
beeping and is granted access to the item.

Other times, however,
the locking system does not unlock the item for whatever reason (for
example, aborts, programming errors, log offs, and so on). It is in
cases such as this, and only in these cases, that this command should
be used.

## Syntax

```
unlock-item file.reference {item.list*} {(options}
```

## Parameter(s)

| options | start.port#{-end.port#} | Used only when a FID is specified in the options string. The FID is implied as a decimal number unless it is proceeded by a period, where it is then considered to be a hexadecimal reference. |
| --- | --- | --- |
| i | Suppresses message item 'x' released. | |

## Example(s)

Displays the current item locks.

```
list-locks (i

Item Locks PIB# Lvl Hash item-ID Filename
29198 (00720E) 33 2 2D52 33109 cx
29003 (00714B) 7 1 2C8E 32914 cx
234034 (039232) 86 0 1923 record2 doc
179222 (02BC16) 25 0 248A 74845480 entity
234034 (039232) 89 0 404B accounts doc
169528 (029638) 35 1 6432 110462 entity
71998 (01193E) 12 0 7250 8462 action
79366 (013606) 79 0 04A4 kr tcl-stack
```
Unlocks the item shown.

```
unlock-item action 8462
[454] Item ’8462’ unlocked.
```

## See also

- [clear-basic-locks macro](https://d3codex.com/tcl/clear-basic-locks-macro/)
- [clear-locks command](https://d3codex.com/tcl/clear-locks-command/)
- [list-lockq command](https://d3codex.com/tcl/list-lockq-command/)
- [lock statement](https://d3codex.com/pickbasic-flashbasic/lock-statement/)
- [Locking scheme](https://d3codex.com/definitions/locking-scheme/)
- [matread statement](https://d3codex.com/pickbasic-flashbasic/matread-statement/)
- [readv statement](https://d3codex.com/pickbasic-flashbasic/readv-statement/)
- [release statement](https://d3codex.com/pickbasic-flashbasic/release-statement/)
- [unlock-group command](https://d3codex.com/tcl/unlock-group-command/)
- [what command](https://d3codex.com/tcl/what-command/)

---
Source: https://d3codex.com/tcl/unlock-item-command/ - part of the D3Codex reference.
