Skip to content

4. Thoroughbred Basic Program Editors

The following sections contain descriptions of Thoroughbred Basic Program Editors.

Purpose

The EDIT utility calls a Thoroughbred Basic program editor, which enables you to create and maintain Thoroughbred Basic programs on a full-screen display. This utility includes a wide range of editing functions. If you have installed Thoroughbred Dictionary-IV you can use the EDITF utility instead of the EDIT utility.

Procedure

To run this utility from Thoroughbred Basic Console Mode type:

EDIT and press Enter.

The EDIT utility uses terminal configuration information from the TCONFIGW file for terminals that use Thoroughbred Basic Windows or the TCONFIG8 file for terminals that do not use Thoroughbred Basic Windows. If a program is loaded in memory, and if the program is not protected by the ENCRYPT or PSAVE directive, the EDIT utility will display the program. If there is no program in memory the EDIT utility will display a blank screen.

The editor operates in Line Mode, which enables you to move to any part of the program, or Edit Mode, which enables you to edit or add program lines. The EDIT utility begins in Line Mode. You can press Enter to switch between Line Mode and Edit Mode.

When you switch out of Edit Mode, Thoroughbred Basic code will be saved in memory. Before you can switch to Line Mode your code will be checked for syntax errors. If an error exists you will remain in Edit Mode until the error is removed. You can press F4 to save your program to a file.

You can change the name of the program editor that Thoroughbred Basic calls by changing a line contained in the IPLINPUT file:

**PRM EDIT=**progname

progname is the new name of the Thoroughbred Basic program editor.

The EDIT utility uses a set of functions to edit Thoroughbred Basic programs. The following is a list of Editing and Function Keys:

Editing Keys
Cursor keys
Line erase
Character insert
Tab
Character delete
Back-tab
Line insert
Home

Line delete

Cursor Keys (up, down, left, and right)
Edit Mode:
The up/down arrow keys move the cursor up or down one line of the program line at a time. The left or right cursor keys scroll the cursor only on the program line that is being edited.
Line Mode:
The up or down arrow keys move the cursor up or down one program line at a time. The left or right cursor keys are ignored.
Character insert
Edit Mode:
Inserts characters in the program line that is being edited.
Line Mode:
This key is ignored.
Character delete
Edit Mode:
Deletes the character that the cursor is currently on.
Line Mode:
This key is ignored.
Line insert
Edit Mode:
This key is ignored.
Line Mode:
Inserts a line between program lines. This allows the entry of new program lines. When inserting a program line, it is only necessary to insert one line. If blank lines are inserted and not used, they are removed when the screen is reprinted or scrolled.
Line delete
Edit Mode:
This key is ignored.
Line Mode:
Deletes the program line that the cursor is currently positioned on.
Tab
Edit Mode:
This key moves the cursor forward five characters at a time.
Line Mode:
This key is ignored.
Back-tab
Edit Mode:
This key moves the cursor backward five characters at a time.
Line Mode:
This key is ignored.
Function Keys
F1 - Page Down
F6 - Help
F2 - DELETE STATEMENT
F7 - PRINT STATEMENT
F3 - Page Up
F8 - Search/Replace
F4 - END
F9 - Reprint screen
F5 - Undo statement
F10 - GOTO statement
F1 - Page Down
Edit Mode:
This function is ignored.
Line Mode:
You can scroll backward one screen at a time. The Page Down key, if available, performs the same function.
F2 - DELETE STATEMENT
Edit Mode:
This function is ignored.
Line Mode:
Deletes a program line or a range of program lines. When F2 is pressed, the following prompt is displayed:

DELETE STATEMENTS: From <Enter=current>:______

To <Enter=current> :______

If one program line is to be deleted and the cursor is currently positioned on that program line, you can press Enter and that program line number or label prints automatically in the input field. If needed, you can specify starting and ending program line number or labels to be deleted.

F3 - Page Up
Edit Mode:
This function is ignored.
Line Mode:
You can scroll forward one screen at a time. The Page Up key, if available, performs the same function.
F4 - END
Edit Mode:
This key exits the EDIT utility and returns you to Thoroughbred Basic Console Mode or whatever mode the editor was called from.
Line Mode:
This key exits the EDIT utility and returns you to Thoroughbred Basic Console Mode or whatever mode the editor was called from.
F5 - Undo statement
Edit Mode:
When a program line is edited, the original is stored temporarily. If, while editing the program line, you make a mistake and want to start again with the original program line, F5 reprints the original program line in the window. When entry mode is terminated, the temporary storage area is cleared.
Line Mode:
This function is ignored.
F6 - Help
Edit Mode:
This function is ignored.
Line Mode:
Lists the Editing Keys and Function Keys.
F7 - PRINT STATEMENT
Edit Mode:
This function is ignored.
Line Mode:
This function lets you print a program line or a range of program lines on the printer. When F7 is pressed, the programmer is asked to select a printer. After a printer is selected the following prompt is displayed:

PRINT STATEMENTS: From<Enter=current>:_____

To <Enter= current>:_____

If only one program line is to be printed and the cursor is currently positioned on that program line, you can press Enter to print. Otherwise, you may enter starting or ending program line number or labels to be printed.

F8 - Search/Replace
Edit Mode:
This function is ignored.
Line Mode:
Lets you search the program for the occurrence of a specific program line number or label or text segment. This function can either search a range of program lines or search to the end of the program. There is also the option of replacing the text found with another text sequence. You can specify only one search and one replace string, each being up to 40 characters long.
F9 - Reprint screen
Edit Mode:
This function is ignored.
Line Mode:
Reprints the entire editor screen. Under certain circumstances, it may be desirable to reprint the screen due to editing conditions.
F10 - GOTO statement
Edit Mode:
This function is ignored.
Line Mode:
Moves to the specified point in the program, either a program line number or label or text segment. When searching for text, you can start from the present position (find next occurrence) or the beginning of the program (find first occurrence):

GOTO-Enter statement # or text segment (“):_______________

Options for GOTO statements

0
GOTO first line in program
7900
GOTO program line 7900, or next program line if 7900 does not exist
99999
GOTO last program line in program
"A9$=
GOTO next occurrence of text A9$= (searches from current cursor position)
"A9$="
GOTO first occurrence of text A9$= (searches from the beginning of the program)
"7900
GOTO next occurrence of text 7900 (note this may be the actual program line number or label or a command reference to this program line)

Purpose

The EDIT directive provides a means of editing single program lines without retyping the entire line. It enables you to copy, replace, delete, and insert strings of text in the program line.

Procedure

To run this directive from Thoroughbred Basic Console Mode type:

EDIT lineref editspec [strconst]

lineref
is the program line number or label to be edited.
editspec
is a letter or blank that specifies how the program line will be edited:
C
copies text from the current position to the last character of the first occurrence of strconst. This is the most common method of positioning in the program line. If no match is found for strconst, Thoroughbred Basic generates an ERR=20.
D
deletes text in the program line from the current position through the first occurrence of strconst. If no match is found for strconst, Thoroughbred Basic generates an ERR=20.
R
replaces text in the program line with the text contained in strconst, byte for byte, space for space.

(absence of an editspec) inserts strconst into the program line starting at current position.

[strconst]
is any string constant (enclosed in brackets) that specifies text associated with editspec.

After you type the editing command press Enter to end the EDIT utility and copy the program line from the current position to the end.

The EDIT directive operates on a program line from left to right, including the full program line number or label. If you use the EDIT directive to change a program line number, the original program line is retained and the edited program line is inserted in the program in the correct position.

Examples:

*ERR
00100 IF X=10 ORRY =123 THEN GOTO 678

To correct the above program line number or label we could use:

EDIT 100 C[OR]D[R]

which lists as:

00100 IF X=10 OR Y=123 THEN GOTO 00678

The program line is copied up to OR, the second R is deleted, and pressing Enter copies the remainder of the program line

00010 DIM ARRAY$[ 10,5 ] [10,“*”]

could have its first dimension changed from 10 to 100 with:

EDIT 10 C[[ 1][0]

which copies out to [ 1 and inserts an extra 0.

Purpose

The EDITF utility calls a Thoroughbred Basic formatted program editor, which enables you to create, edit, and maintain Thoroughbred Basic programs on a full-screen display. This utility includes a wide range of editing functions, formatting options, and on-line help. If you have installed Thoroughbred Dictionary-IV and your terminal is configured to display Thoroughbred Basic Windows, you can use the EDITF utility. You must log in to Thoroughbred Dictionary-IV before you can use this utility.

If you have not installed Thoroughbred Dictionary-IV, or if your terminal is not configured to use Thoroughbred Basic Windows, you must use the EDIT utility.

Procedure

To run this utility from Thoroughbred Basic Console Mode type:

EDITF

After you press Enter, the EDITF menu is displayed. This menu enables you to select an editing option:

  • Structured: If a program is in memory it is displayed in structured programming format. Compound statements are broken into multiple lines, continuation lines are indented, and program control commands such as IF/THEN/ELSE/FI, WHILE/WEND, and FOR/NEXT are formatted to display the logical structure of the command.
  • Unstructured: If a program is in memory it is displayed with minimal formatting. This option requires less memory than the Structured option, so it may run faster.
  • Range of Statements: If a program is in memory, you can display a subset of program lines. After you select this option you can type line1,linen to display a range of program lines. After you edit the selected lines, you can save them back into the program residing in memory.
  • SOURCEROR: This option calls Thoroughbred Source-IV, a program maintenance and source control system.

If a program is loaded in memory, and if the program is not protected by the ENCRYPT or PSAVE directive, the EDITF utility will display the program. If there is no program in memory the EDITF utility will display a blank screen.

The EDITF utility has a wide variety of functions to help you edit Thoroughbred Basic programs. For more information, you can press one of the following function keys:

F6 calls the EDITF help system, which provides information on EDITF functions and keystrokes.

F3 calls on-line documentation, which provides information on the EDITF utility, Thoroughbred Basic, and so on.

After you are done entering a new program or editing an old program you can leave the EDITF utility by pressing F4. The EDITF utility will ask if you want to save the program into memory. If you want to save the program to a disk file, you must also use the Thoroughbred SAVE directive when you return to Thoroughbred Basic Console Mode.

When you exit the EDITF utility, a RESET is performed and the program execution pointer is set to the first statement. If you need to edit a program without doing a RESET and resetting the program execution printer, you can use the EDIT program line directive or the EDIT utility.

Example:

LOAD “TESTPGM” EDITF

After the TESTPGM program is loaded into memory, the EDITF utility enables you to edit the program.

From the Thoroughbred Basic Utilities, version 8.9.1. Open this page in the PDF