# create-file command

The create-file BASIC program creates
a new dictionary and data file, a dictionary-only file, or a new data
section on an existing dictionary file; space is allocated and reserved
if available.

**Synonyms:** cf

Warning: It is recommended that you familiarize
yourself with the [File](https://d3codex.com/definitions/file/) before using this command.

## Syntax

```
create-file file.reference dict.modulo data.modulo{(options)}
create-file dict file.reference dict.modulo{(options)}
create-file data dictionary.reference, data.reference data.modulo{(options)}
```

## Parameter(s)

| file.name | Name of the file to be created in the current account. | |
| --- | --- | --- |
| dict.name | Name of a dictionary to be created in the current account. | |
| data.name | Name of a data file to be created in the specified dictionary. | |
| dict.modulo | Indicates the number of frames to reserve in the primary file space for dictionary items. | |
| data.modulo | Indicates the number of frames to reserve in the primary file space for data items. Any file can contain binary pointer items, so this code is not needed. Note: The maximum allowed modulo for a file in the VME is 16777213. | |
| options | d | Creates the file in an alternate directory. |
| e | Specifies to encrypt the data in the file being created. See encrypt-file command for more information. | |
| f | Suppresses logging clear-file information in the file of files file by placing a c in attribute 17 of the file of files file item. | |
| l | Specifies that any updates to this file are logged to the transaction logger. This option is not compatible with the x or y options. | |
| n | Negates all update protection for the given file irrespective of the global update protection setting. This option is not compatible with the u option. | |
| p | Primary file space is to contain only pointer (indirect) items regardless of item length. Pointer-files are not supported in the FSI. | |
| q | Prevents files from being resized. This allows sequential commands (for example, count) to be used without having to update the File Control Block. Warning: Administrators should not clear the q d-code and start a resize unless you are certain that there are no sequential operations in progress on the file. See the u option of the resize command for a description of the potential problems that may occur. | |
| r | Allows the creation of a file in another account. When this option is used, the system prompts for the account the file is to be created in. | |
| s | Item-IDs are case-sensitive. This option is compatible with all other options. | |
| t | Specifies that any updates to this file are not logged to the transaction logger. | |
| u | Enables update protection for the given file irrespective of the global update protection setting. This option is not compatible with the n option. | |
| x | Does not save the file on backups (file-save, account-save, and so on). The file does not exist after a file restore. | |
| y | Does not save the data in this file on backups (file-save, account-save, and so on). On a file restore, the file is recreated, but empties. | |
The options above are included as part of the dictionary
code in the file identification items in the master dictionary for
dictionary files and in the file dictionary for data files.

The l, x, and y options can also be added or deleted from an existing dictionary
code by using update or ud.
The `s` code cannot be added or deleted.

Warning: D3 allows separation to be indicated, but ignores
it.

The path names to other accounts cannot be used. The
syntax varies according to the section of the file being created.
For example:

- First form creates a new file with both data and dictionary sections.

- Second form creates a new file with only a dictionary section.

- Third form creates a new data file section in an existing dictionary.

The internal modulos actually used may be slightly higher
to give a more optimal hashing scheme.

When a dictionary-only
file is created, a Q-pointer (synonym-defining item) with the file
reference as its item-ID, is automatically created in the dictionary.
This allows the file to be accessed without specifying dictionary.

## Example(s)

Creates both a new dictionary
and data section.

```
create-file customers 7 101
```
Creates a dictionary-only file.

```
create-file dict pointer-file 31
```
Creates a new data section called archive and places a
pointer to it in the dictionary of customers. The new data section
may now *share* all the attribute-defining items
in the customers dictionary.

```
create-file data customers,archive 101
```

## See also

- [account-save command](https://d3codex.com/tcl/account-save-command/)
- [clear-file command](https://d3codex.com/tcl/clear-file-command/)
- [conv-case command](https://d3codex.com/tcl/conv-case-command/)
- [d/code1](https://d3codex.com/attributedefiningitem/d-code1/)
- [delete-file command](https://d3codex.com/tcl/delete-file-command/)
- [file-save command](https://d3codex.com/tcl/file-save-command/)
- [Group](https://d3codex.com/definitions/group/)
- [item command](https://d3codex.com/tcl/item-command/)
- [Linked overflow](https://d3codex.com/definitions/linked-overflow/)
- [Modulo](https://d3codex.com/definitions/modulo-glossary/)
- [move-file command](https://d3codex.com/tcl/move-file-command/)
- [Primary file space](https://d3codex.com/definitions/primary-file-space/)
- [prime command](https://d3codex.com/tcl/prime-command/)
- [save command](https://d3codex.com/tcl/save-command/)
- [Scrubber](https://d3codex.com/definitions/scrubber/)
- [txlog command](https://d3codex.com/tcl/txlog-command/)
- [txlog-status command](https://d3codex.com/tcl/txlog-status-command/)
- [update-logging command](https://d3codex.com/tcl/update-logging-command/)

---
Source: https://d3codex.com/tcl/create-file-command/ - part of the D3Codex reference.
