# set-remote-close command

The set-remote-close command toggles
on and off the BASIC close command’s ability to close remote files.

## Syntax

```
set-remote-close {(options}
```

## Parameter(s)

| options | d | Sets the on or off action system-wide. |
| --- | --- | --- |
| n | Toggles the feature on. Associated remote files are closed and resources such as handles and memory are released when the program completes or issues a close command. | |
| f | Toggles the feature off (default). Resources allocated to open files, such as handles and memory, are not released until the process logs off. | |
This command allows the entire system or a specific user
to favor either:

- performance when remote closing is off and everything is cached

- resource availability when remote closing is on and resources are freed

Note: Some resources cannot be released if other processes have
the same file open.

Each client maintains a cache of remote
files. A usage counter that increments every time the file is opened
and decrements every time the file is closed is maintained for each
file in the cache. The close command is issued
to the server when the counter decrements to zero.

Parent levels
of the file level opened are automatically opened and closed when
the child level opens and closes. For example, if a data level is
opened, the dict and MD levels are also opened, and their usage counters
are adjusted accordingly.

When a BASIC select list is active,
the file cannot be closed (even with the close command)
until readnext statements have exhausted the list.

Warning: The usage counters are maintained by actual open and close calls, whether performed
by a program or the system. If a program opens a file once and copies
the file variable to other variables, the counter is incremented once.
A close command must be issued to close the file.

---
Source: https://d3codex.com/tcl/set-remote-close-command/ - part of the D3Codex reference.
