Document revision date: 30 March 2001

## OpenVMS User's Manual

Previous | Contents | Index

#### 8.19.1.1 Spawning to EVE from DCL

Rather than spawn a process to use DCL, you can spawn a process for an EVE editing session and then attach to the parent DCL process to use DCL commands and utilities.

When you want to return to the DCL command level, use the EVE command ATTACH to return to the parent process.

To resume your editing session, reconnect to the editing subprocess by using the DCL command ATTACH with the process name of the subprocess.

In the following example, a subprocess is created using the DCL command SPAWN. The SPAWN command creates the subprocess SMITH_1. At the subprocess level, EVE is invoked and the editing session is conducted. At the end of the editing session, the ATTACH command is entered and you are returned to DCL. Then, to resume the editing session,the DCL command ATTACH is entered using the the process name of the subprocess SMITH_1:

    $ SPAWN
    %DCL-S-SPAWNED, process SMITH_1 spawned
    %DCL-S-ATTACHED, terminal now attached to process SMITH_1

    [End of file]

    Buffer: MAIN                        | Write | Insert | Forward
    Command: ATTACH SMITH

    $ ATTACH SMITH_1

## Chapter 9
Editing Text Files: Using EDT

Although the default text editor on the OpenVMS operating system is EVE, you may also want to use the EDT editor. EDT is an interactive text editor with which you can create a new file, insert text into it, and modify that text. You can also edit text in existing files with EDT.

EDT provides both line editing and keypad editing. In line editing, you type the editing command and the range of text you want the command to affect. In keypad editing, you move the cursor directly to the text you want to change and press keypad keys to enter the editing commands.

One way to use EDT is to use the keypad as the primary editing mode in combination with various line-editing commands. You can also redefine certain keypad and control keys to perform editing functions not available in keypad mode. This is called nokeypad editing. Nokeypad commands are the basis for keypad mode key definitions and consist of English words and abbreviations. You can use nokeypad mode commands to define keys.

This chapter describes:

- Beginning EDT editing sessions
- Using EDT line commands
- Entering EDT keypad commands
- Using online help in EDT
- Ending EDT editing sessions
- Changing editing modes
- Recovering from interruptions
- Summary of EDT commands

For more information about using the EDT editor, refer to the OpenVMS EDT Reference Manual.

## 9.1 Beginning EDT Editing Sessions

To invoke EDT, enter the DCL command EDIT/EDT followed by the name of the file you want to edit. The first few lines of the latest version of the file appear on the screen. The cursor is positioned at the top of the screen, and EDT is ready to receive a keypad-editing command.

In the following example, a file named MEMO.TXT is edited:

    $ EDIT/EDT MEMO.TXT

    Once the weather turns cold, mice may find a crack in your
    foundation and enter your house.  They're looking for food and
    shelter from the harsh weather ahead.

    [EOB]

### 9.1.1 Editing Existing Files

When you edit a file that already exists (for example, if you created the file during a previous session), EDT saves the existing versions and places a copy of the latest version in your buffer. A buffer is the temporary storage area in which you edit text. The existing versions of the file remain unchanged.

### 9.1.2 Creating Files

If you invoke EDT to create a file, the following message appears:

    $ EDIT/EDT NEWFILE.TXT

    Input file does not exist
    [EOB]
    *

Only the EDT message and the end-of-buffer symbol ([EOB]) appear on the screen, and EDT is ready to receive keypad-editing commands.

### 9.1.3 Changing Editing Modes

In the previous examples, you enter EDT in keypad (change) mode because a startup command file (SYS$LOGIN:EDTINI.EDT) containing the SET MODE CHANGE command has been executed. If this command is not executed in an EDT startup command file, you enter EDT in line mode. Enter the CHANGE command at the asterisk (*) prompt to change to keypad mode.

For information on creating a startup command file, see the OpenVMS EDT Reference Manual.

## 9.2 Using EDT Line Commands

EDT prompts for line-editing commands with an asterisk (*). Line-editing commands usually operate on a range of one or more lines of text that you specify as a parameter for the command. You can abbreviate EDT line-editing commands. For clarity, the examples in this chapter show complete line-editing commands.

The following example shows the line editing command that you would enter to display an entire file on your screen:

    *TYPE WHOLE

### 9.2.1 Using Line Numbers

To help you locate and edit text, EDT assigns line numbers. These line numbers are not part of the text and are not kept when you end an editing session.

When you insert new text, EDT numbers the lines using decimal numbers. For example, if you add a line of text between lines 13 and 14, it is numbered 13.1. To avoid confusion when working with decimal numbers, enter the RESEQUENCE command. The RESEQUENCE command renumbers all the lines from the cursor to the end of the buffer in increments of one.

Note that the EDT line-editing command SET NUMBERS (the default) must be in effect for line numbers to be displayed in EDT line editing.

The following example shows how to display all the line numbers in an existing file:

    * TYPE WHOLE
        1          oneoneoneoneoneoneone
        2          twotwotwotwotwo
        3          threethreethree
        4          fourfourfourfour
        5          fivefivefivefive
    [EOB]
    *

### 9.2.2 Specifying a Range of Lines

Some EDT line-mode commands can affect a range of lines. For example, the INSERT command will create a new line of text in your buffer; to insert a new line of text at the beginning of your buffer, enter the command INSERT BEGIN.

Table 9-1 describes the different ranges you can specify when you edit a file in line mode.

Table 9-1 EDT Line-Mode Command Ranges
Range Type | Description
--- | ---
period (.) | Current line
number | EDT line number
'string' | Next line containing the quoted string
BEGIN | First line of the buffer
END | After the last line in the buffer ([EOB])
LAST | Last line EDT was at in the previous buffer
WHOLE | Entire buffer
BEFORE | All lines in the buffer before the current line
REST | All lines in the buffer starting with the current line and ending with the last line

Table 9-2 lists symbols and words that you can combine with the line-mode command ranges.

Table 9-2 EDT Command-Line Symbols for Specifying Ranges
Symbol or Word | Description
--- | ---
, or AND | Used to join noncontiguous ranges in a list; only single lines can be joined in this way
: or THRU | Indicates a group of lines starting with the first range specifier and ending with the second
n | Indicates the number of lines from the current line
# n or FOR n | Indicates the next n number of lines
+ "string" or "n" | Indicates that string or n refers to a line or lines after the current line
-- "string" or "n" | Indicates that string or n refers to a line or lines before the current line
ALL "string" or "n" | Indicates that the command applies to all lines containing string

### 9.2.3 Canceling EDT Commands

Use Ctrl/C to cancel the currently executing EDT command without affecting previous edits. For example, to stop the display of a long file, press Ctrl/C.

    *TYPE WHOLE
     .
         .
         .
    [Ctrl/C]
    Cancel
    Press return to continue
    [Return]
    Aborted by CTRL/C

## 9.3 Entering EDT Keypad Commands

While line editing allows you to manipulate large portions of text easily, keypad editing provides easy manipulation of small units of text. EDT keypad commands enable you to find, insert, delete, substitute, and move text in a file. The cursor can be moved through a file in a variety of ways. The position of the cursor in a file determines how text will be affected by EDT commands.

### 9.3.1 Keypad Editing

In keypad editing, the screen displays editing changes as you make them. You type text from the main keyboard and enter keypad-editing commands from the numeric keypad. To display a diagram of the keypad keys, press PF2 while in keypad mode. To initiate keypad editing, you must first enter the line-editing command CHANGE or have SET MODE CHANGE in your EDT startup file. See Section 9.6.2 for information on the CHANGE command.

In keypad mode, you can manipulate the cursor with commands that move it unit-by-unit through the text or with commands that move it directly to a particular location.

Each key in the keypad performs at least one editing command; most perform two. Pressing a key invokes the primary function. To invoke the alternate function of a key, press the GOLD key (labeled PF1) first, then press the desired key. In the examples that follow, the text associated with the keypad illustrates the effect of that editing command.

The supplemental editing keys on the keypad perform the same functions as some of the EDT keypad keys.

Example: Using the WORD Function

Keypad key 1 (KP1) performs both the WORD and the CHNGCASE functions. To enter the WORD command, press KP1. The cursor moves to the beginning of the next word.

    Once the weather turns cold, mice may
    find a crack in your foundation and enter your house.  They're
    looking for food and shelter from the harsh weather ahead.

    [EOB]

Example: Using the CHNGCASE Function

To enter the CHNGCASE command, press the GOLD key first and then CHNGCASE. The character at the cursor (or the characters highlighted with the Select key) changes from lowercase to uppercase or from uppercase to lowercase.

    Once The weather turns cold, mice may
    find a crack in your foundation and enter your house.  They're
    looking for food and shelter from the harsh weather ahead.

    [EOB]

The "T" in the word "The" is now capitalized.

## 9.4 Using Online Help in EDT

The following sections describe how to use online help during an EDT editing session.

### 9.4.1 Getting Keypad Help

In keypad mode, you can display a diagram of the keypad keys by pressing PF2. On LK201-series keyboards, you can also use the Help key on the supplemental editing keypad. To display information about a particular keypad command, first press the Help key and then press the keypad key.

### 9.4.2 Getting Line Mode Help

To request help in EDT while in line mode, enter the HELP command at the asterisk (*) prompt and press Return. To display information about a particular command, type HELP followed by the name of the command. EDT displays information about the command and lists related topics. For example, to request help on the COPY command, enter the following command line:

    *HELP COPY [Return]

### 9.4.3 Getting Nokeypad Help

If you are in nokeypad mode and want to get help information about nokeypad commands, enter HELP CHANGE at the asterisk (*) prompt.

## 9.5 Ending EDT Editing Sessions

To terminate an EDT session, press Ctrl/Z. This puts you into line-editing mode. You can type EXIT or QUIT at the asterisk (*) prompt. EXIT saves your edits in a new version of the file; QUIT terminates the editing session and does not save your edits.

The existing versions of a file remain unchanged regardless of how you end the editing session. To override the default output file name, enter the EXIT command with a new file specification as the parameter. Note that if a file is given the same file name as an existing file, the two files will have the same file name and file type, but different version numbers and content.

### 9.5.1 Saving Edits When You Exit

By default, the EXIT command creates an output file with the same file name and file type as the input file but with the version number incremented by 1.

In the following example, the EXIT command is entered after a file named MEMO.TXT;3, is edited. EDT then creates a higher version named MEMO.TXT;4:

    *EXIT
    DISK1:[USER]MEMO.TXT;4  2 lines
    $

If the same editing session is ended with the command EXIT MICE.TXT, EDT names the output file MICE.TXT;1, provided no other file named MICE.TXT exists. If a file named MICE.TXT exists, EDT names the output file MICE.TXT; version-number, where version-number is one greater than the highest version number of an existing MICE.TXT file.

### 9.5.2 Ending EDT Sessions Without Saving Edits

To terminate EDT without saving your edits, use the line-editing command QUIT. All edits you have made to the text are ignored, and no output file is created.

The QUIT command is a useful way to terminate EDT when you have opened a file by mistake. No new file version is created.

## 9.6 Changing Editing Modes

You can switch back and forth between line and keypad editing. You can also enter line-editing commands from keypad mode. If find yourself frequently returning to line mode to enter EDT commands, you might find it easier to work in line mode. For example, if you are examining a file on a line-by-line basis, using line numbers as reference points, line-mode editing is more appropriate. In contrast, if you need to examine, cut, and paste large chunks of text between nonadjacent areas within a file or between two files, keypad editing might be faster.

### 9.6.1 Changing from Keypad to Line Editing

To change from keypad editing to line editing, press Ctrl/Z. When you see the asterisk (*) prompt at the bottom of your screen, enter a line-editing command at the prompt. For example:

    Once the weather turns cold, mice may find a crack in your
    foundation and enter your house.  They're looking for food and
    shelter from the harsh weather ahead.

    [EOB]
    [Ctrl/Z]

    * INSERT

### 9.6.2 Changing from Line to Keypad Editing

To change from line editing to keypad editing, enter the CHANGE command:

    *CHANGE

The first 22 lines of the file display on your screen. If the file has fewer than 22 lines, the [EOB] symbol appears below the last line of the file.

### 9.6.3 Entering Line-Editing Commands from Keypad Mode

The keypad COMMAND function allows you to enter line-editing commands without leaving keypad mode. First, enter the COMMAND function by pressing the GOLD key (PF1) and then the COMMAND key (KP7).

EDT displays the Command: prompt. At the prompt, enter a line-editing command.

The following example enters the line-editing command SET QUIET, which suppresses the sound made when EDT issues an error message. To execute the command, press the Enter key. (If you press Return by mistake, ^M appears; delete the ^M by pressing the Delete key on the main keyboard and press Enter.)

    Once the weather turns cold, mice may find a crack in your
    foundation and enter your house.  They're looking for food and
    shelter from the harsh weather ahead.

    [EOB]
    Command:   SET QUIET

## 9.7 Recovering from Interruptions

The following sections describe how to recover from interruptions during an EDT editing session.

### 9.7.1 Restoring the Display

Pressing Ctrl/W removes extraneous characters (such as a broadcast message or a message indicating that you have received electronic mail) from the screen and restores the previous display. Use Ctrl/W to ensure that the cursor is in the correct position.

### 9.7.2 Recovering from Ctrl/Y

The DCL command CONTINUE resumes an editing session that was interrupted by pressing Ctrl/Y, as long as only built-in DCL commands were entered after pressing Ctrl/Y. For example, you could press Ctrl/Y, enter the command SHOW TIME, and return to your editing session with the CONTINUE command. You enter the SHOW TIME and CONTINUE commands at the DCL prompt.

After you enter the CONTINUE command, press Ctrl/W to refresh the screen display. EDT redisplays the text of your editing session.

### 9.7.3 Journal Files

By default, EDT keeps a journal file with the same file name as the input file and a file type .JOU. If the editing session ends without interruption, the journal file is deleted when you terminate the session. If the editing session is aborted (for example, during a system failure, in response to pressing Ctrl/Y, or entering the QUIT/SAVE command), you can recover your edits with the exception of those commands entered just prior to the interruption. Enter the same command line you used to begin the editing session, adding the /RECOVER qualifier. For example:

    $ EDIT/RECOVER MICE.TXT

EDT will reproduce the editing session, reading the commands from the journal file and executing them on the screen.

## 9.8 Summary of EDT Commands

The following sections list the commands and keys you can use to perform specific EDT operations.

### 9.8.1 Changing Editing Modes

The following table describes commands and keys that can be used to change edit modes:

Keypad Mode | Line Mode | Nokeypad Mode | Description
--- | --- | --- | ---
COMMAND |  | EXT (Extend) | Enables you to enter a line-mode command while EDT is still in keypad or nokeypad mode.
Ctrl/Z | CHANGE | EX | Transfers your editing session from one mode (line, keypad, or nokeypad) to another.
| SET MODE |  | Establishes the initial mode of the EDT session when used in a startup command file.
| SHOW MODE |  | Indicates which SET MODE command was most recently issued.

### 9.8.2 Moving the Cursor

The following table describes commands and keys that can be used to move the cursor:

Keypad Mode | Line Mode | Nokeypad Mode | Description
--- | --- | --- | ---
BACKSPACE |  | BL | Moves the cursor to the beginning of the current line.
BOTTOM | TYPE END | ER | Moves the cursor to the end of the buffer, after the last character position in the buffer.
CHAR |  | C | Moves the cursor one character in the current direction (forward or backward, depending on whether ADVANCE or BACKUP is in effect).
Down arrow key |  | Down arrow key | Moves the cursor down one line toward the bottom of the buffer, regardless of whether ADVANCE or BACKUP is in effect.
EOL |  | EL | Moves the cursor to the end of the current line if the direction is forward. If the current direction is backward, the cursor moves to the end of the previous line.
Left arrow key |  | Left arrow key | Moves the cursor one character to the left, regardless of whether ADVANCE or BACKUP is in effect.
|  | "move" | Moves the cursor within the current buffer.
LINE |  | L | Moves the cursor to the beginning of the next line if the direction is forward or to the beginning of the current line if the direction is backward. If the direction is backward, pressing LINE again moves the cursor to the beginning of the previous line.
|  | KS | Modifies the position of the cursor at the completion of the PASTE command.
PAGE |  | PAGE PAGETOP | Moves the cursor to the right of the next page marker or to the next form-feed character. If you have no page markers (defined with the SET ENTITY PAGE command), the PAGE entity is the whole buffer.
|  | TOP | Moves the cursor to the top of the screen.
Right arrow key |  | Right arrow key | Moves the cursor one character to the right, regardless of of whether ADVANCE or BACKUP is in effect.
SECT |  | 16L. | Moves the cursor one section (16 lines) toward the end or the beginning of the buffer, depending on whether ADVANCE or BACKUP is in effect.
| SET CURSOR |  | Controls scrolling of the screen relative to the cursor position. This command has no effect if you are editing in line mode.
| SHOW CURSOR |  | Displays values set by the SET CURSOR command.
TOP |  | BR | Moves the cursor to the first character at the beginning of the buffer.
Up arrow key |  | Up arrow key | Moves the cursor up one line toward the top of the buffer regardless of of whether ADVANCE or BACKUP is in effect.
WORD |  | W | Moves the cursor to the beginning of the next word in the current direction (forward or backward, depending on whether ADVANCE or BACKUP is in effect).

Previous | Next | Contents | Index

| privacy and legal statement |
6489PRO_020.HTML