# Prestore commands

Prestore commands are a series of Update processor commands
that can be saved and recalled for later use. Once defined and saved,
prestore commands can be used during the current update session or
recalled and used in subsequent update sessions.

There is one active prestore buffer available for each
update session. This buffer can be used again as many times as necessary.
Prestore commands can be loaded into the buffer and modified using
Update processor cursor movement commands. The default prestore buffer
contains the command CTRL+ZN, which advances the cursor to the next
page.

Note: The default buffer contents do not display when editing
the prestore buffer.

There is no limit to the number of
prestore commands available because prestore commands are saved as
items in a file. The items remain in the file until they are deleted
or overwritten.

The MD is the default file used for saving prestore
commands, but any legal file reference may be used.

Prestore
commands may contain both Update processor commands and literal text.
When literal text is included as part of the command, the text must
be enclosed in single or double quotation marks.

When an Update
processor command is included as part of the prestore command, the
Update processor command is typed *without* pressing the CTRL
key. The Update processor interprets as an Update processor command
anything *not* enclosed in quotation marks.

| Command | Description |
| --- | --- |
| CTRL+P | Executes the command stored in the prestore buffer. If there is no command in the prestore buffer, CTRL+P advances the cursor to the next page (by invoking the default prestore buffer command CTRL+ZN). When working on an active list, if CTRL+P is the last command in a prestore command, the entire prestore command is repeated until the list is exhausted. The example below illustrates how to create a prestore command used to search and replace text in a list of items. ```
get-list items
u document
CTRL+ZL
a’old’r’new’nxfp<Enter>
CTRL+P
``` |
| CTRL+ZL | Create or edit a prestore command in the prestore buffer. Most Update processor commands are available to input and edit the prestore buffer. After typing CTRL+ZL, the Update processor displays the following prompt: ```
P:
``` Type the prestore command, then press ENTER. CTRL+P is used to execute the prestore command. |
| CTRL+ZR {(file.reference}item-ID | Loads a previously saved prestore command into the prestore buffer and, optionally, executes the prestore command. The first attribute in the item must be a p. The default file is the MD. After CTRL+ZR has been entered, the following prompt displays: ```
Prestore id:
``` The response to this prompt can either be an item-ID (if the prestore command is stored in the current MD) or a file reference and item-ID (if the prestore command is stored in a file other than the current master dictionary.) The item-ID is followed by either pressing CTRL+M or CTRL+P. When the CTRL+ZR is followed by pressing ENTER, the contents of the prestore command are loaded in the prestore buffer but the command is not executed. When the CTRL+ZR command is followed by a CTRL+P, the prestore command is executed. Once the prestore buffer has been loaded, it can be executed any time during the current update session using CTRL+P. The following example shows how to load the prestore buffer with a saved prestore command from the current master dictionary without executing the prestore command. CTRL+ZR command to load prestore buffer Prestore id: terminal prompt for item-ID id item-ID from MD The next example shows how to load the prestore buffer with a saved prestore command from the file ’commands’ using the item-ID of ’holdit’. The command is immediately executed using CTRL+P. CTRL+ZR command to load prestore buffer Prestore id: terminal prompt for item-ID (commands,holditCTRL+P file.reference,item-ID, execute |
| CTRL+ZR {(file.reference}item-ID | Load the specified item into the prestore buffer and execute it. The first attribute in the item must be a p. The default file is the MD. When the CTRL+ZR command is followed by a CTRL+P, the prestore command is executed. |
| CTRL+ZW {(file.reference}item-ID CTRL+M | Writes the contents of the prestore buffer to a file for reuse. The character p is written as the first attribute of the item. The default file is the MD. CTRL+ZW displays the following Update processor prompt: ```
Prestore id:
``` At this time, either of the following can be specified: Item-ID. The prestore item is saved in the current MD. If the MD already has an item with the specified item-ID, the following prompt displays: ```
prestore.id item exists on file, press y to overwrite:
``` ```
prestore.id item exists on file, press y to overwrite:
``` If y is typed, the MD item on file is overwritten with the prestore command. If any key other than y is typed, the prestore item is not saved. File reference and item-ID. The item is written to the designated file with the specified item-ID. The format of the saved item is: attribute 1 = p attribute 2 = prestore command The example below shows a prestore command consisting of Update processor commands and text. This command does the following: ```
CTRL+MM
CTRL+R
’This is text’CTRL+M
CTRL+R
``` The command is saved in the file commands with the ID of holdit. ```
u document document.id
CTRL+ZL
P: mmr’This is text’mr<Enter>
CTRL+ZW
Prestore id: (commands holdit<Enter>
user-defined file and item-ID
``` The commands holdit file contains the following: 01 P 02 mmr’This is text’mr |

## See also

- [Cursor movement commands](https://d3codex.com/updateprocessor/cursor-movement-commands/)

---
Source: https://d3codex.com/updateprocessor/prestore-commands/ - part of the D3Codex reference.
