EDIT Verb - Edit Program Line


EDIT lineref {[editoptions]}


The EDIT verb makes it possible to edit a program line without having to retype the entire line. EDIT is valid only in console mode and may not be part of a compound statement.




Number of the line to be edited.


Series of editing commands, as described in "Using the EDIT Commands." If this parameter is not included, PRO/5 invokes an interactive edit window on the terminal screen, as described below in "Using the Interactive EDIT."

Using the EDIT Commands

Each of the four EDIT commands consists of a letter followed by text enclosed in brackets [ ] or braces { }.

Edit Command

Edit Operation




Copies text from an old version to a new version until the text within the brackets has been found. For example, C[GOTO] copies text up through the next occurrence of "GOTO". Provide enough text to avoid confusion when using C[ ].



Inserts text at any given point. In this case the "I" is optional. For example, I[PRINT] or [PRINT] causes the text, "PRINT", to be inserted into the new version at the current point.



Causes EDIT to skip from the current point in the old version through the next occurrence of text without copying anything to the new version and deletes the text.



Places text into the new version, while skipping the same number of characters in the old version.

The following is an example of an edit command:

C[any text]

To understand the basic concept of the EDIT command, think of EDIT as using the current version of a program line to create a new version. EDIT copies the old version character-by-character to the new version. At any point, EDIT can insert new text, delete old text, or replace old text with the same amount of new text. The edit commands in the EDIT statement control this process.

When EDIT reaches the end of editoptions, it copies any remaining text from the old version to the new version and tries to place the new version in the program. If the line number was changed as part of the edit, the new version creates a new line in the program and leaves the old line intact. An error is issued if a line zero, or console mode line, was created.


To edit

0100 IF A<B OR C$=D$ THEN GOTO 2033

in order to create a new version:


The following edit command would be used:

>EDIT 100 C[<B] D[D$] C[N] [ PRINT A;] C[TO ]R[4000]

The spaces between edit commands are optional and were used for readability. When a program line is short, as in this case, it may be quicker to simply retype the line.

Using the Interactive EDIT

If no editoptions are present in the EDIT statement, PRO/5 attempts to create a window on the terminal screen for interactive editing. If there is insufficient workspace, an !ERROR=31 is issued. While in the window, the cursor may be moved for editing. After editing, press <RETURN> to exit the window. If there are errors in the new line, PRO/5 refuses to exit the window and places the cursor near the error point. If the cause of the error cannot be found, place a "REM" at the start of the line for valid syntax.

While in the edit window, the cursor can be moved to make changes to the text. As regular text is typed, PRO/5 either inserts the text while adjusting the surrounding text (insert mode), or overlays the existing text with the new text (typeover mode). Change from typeover to insert and back by using CTL-T, or with Visual PRO/5, use the <Insert> key. In PRO/5, and in VPRO/5 when using the character window-based editor instead of the dialog box editor, editing mode will depend on the value of SETOPTS byte 1 bit $20$. If this bit is set, editing will begin in insert mode. If not set, editing will begin in replace mode. Toggling the EDIT mode with CTL-T will also toggle this SETOPTS bit. In PRO/5, there is no visible indication of which mode is active. In Visual PRO/5, the bottom left corner of the EDIT window indicates Insert or Overtype mode.

The following is a partial list of the default editing commands for UNIX or DOS systems:




Accept input and exit with CTL=0


Move right


Move right


Move left

^H (backspace)

Move left - delete character if at end of input


Move up


Move up


Move down

^J (linefeed)

Move down

^I (tab)

Next tab stop

^B (backtab)

Previous tab stop


Restore data


Toggle insert/overstrike mode


Beginning of line


End of line


Clear to end of line


Delete character


Insert character


Delete line


Insert line


Refresh display

NOTE: This default list may be different, based on the host operating system. For a complete explanation of the editing commands recognized by PRO/5, see PRO/5 Editing in the User's Reference Guide.

Console Mode Edit

When in console mode, entering an empty line terminating with CTL=3 (usually the Function 3 key) brings the prior console mode line up in an edit window. An incorrect console mode line can be changed without having to retype the whole line.


In console mode, either of two shortened forms of the verb may be used:

ED lineref {editoptions}

or the verb may be represented by a single quote mark:

'lineref {editoptions}

See Also

Verbs - Alphabetical Listing