# search-system command

The search-system BASIC program searches
every file in the D3 file system for the existence of one or more
strings of characters in any attribute and optionally creates and
saves a list. If a master dictionary name is provided, only that account
is searched. The search-system command searches
remote accounts (Q-pointers) in the mds.

**Synonyms:** find2

## Syntax

```
search-system {destination.file} {(options)}
```

## Parameter(s)

| options | ? | Displays online usage information about the process. |
| --- | --- | --- |
| a | Displays all items searched, including items in which the string was not found. | |
| c | Clears the output file prior to execution. | |
| m | Checks for multiple occurrences. | |
| p | Directs output to the system printer via the spooler. | |
| s | Suppresses display on the screen. | |
| q | Searches remote accounts and files. | |

The search-system command scans each
item in each file looking for a string match in any attribute. If
a match is found, it displays the item-ID, and the attribute containing
the matching string. Any number of unique strings may be specified.
The search is successful if any one string matches any portion of
the attribute.

This process prompts with these messages:

```
Enter the output file name?
```

Enter the name of the file where the found items are saved
(it must already exist). As items are found, control items are added
to the output file, using sequentially-assigned numeric item-IDs beginning
with 1.

```
Enter the search string?
```

Enter the string without any enclosing delimiters. The
system repeatedly asks for additional strings. A question mark can
be used as a *wildcard* character in the string (up to 15 different
strings can be specified).

The question mark can be used as
a *wildcard* search character. To locate a string that contains
a question mark, type ??. After the last string
has been entered, press ENTER at the ...string? prompt,
advances to the next prompt.

```
Start level 0-mds, 1-master dictionary, 2-file dictionary, 3-data file?
```

The example above tells the process at which *level* of the file system to begin the search. The search-system command has hierarchical level control. The four levels are:

- mds

- md

- dict file

- data file

Any range can be specified. A data file search can also be
specified to search system-wide horizontally. Enter the *level* to begin the search.

Next, the system asks either:

```
Stop Level 0-mds, 1-master Dictionary, 2-file Dictionary, 3-data File?
```

or

```
Lateral Level 0-mds, 1-master Dictionary, 2-file Dictionary, 3-data File?
```

This is the level to continue the search. The routine
can either traverse a single branch of the hierarchy (such as a single
account and all its files) or it can traverse *laterally* across
the branches (such as all the data files *only* of all the accounts).
The *stop/lateral* level must be equal to or lower than the *start* level.

Output is an item of the format:

```
001 mds (account name)
002 dict, data file name
003 item-ID
004 attribute number in which text was found
005 attribute text
006 the search string
```

## See also

- [compare command](https://d3codex.com/tcl/compare-command/)
- [find command](https://d3codex.com/tcl/find-command/)
- [find2 command](https://d3codex.com/tcl/find2-command/)
- [search command](https://d3codex.com/tcl/search-command/)

---
Source: https://d3codex.com/tcl/search-system-command/ - part of the D3Codex reference.
