TOPS-20 User's Guide

Chapter 5 Creating and editing files

This chapter describes:

  1. Selecting an editor
  2. Defining the logical name EDITOR:
  3. Correcting Typing Errors


5.1 Selecting an editor

The TOPS-20 Operating System allows you to create or change files by using a system editor program. DIGITAL supports three editors for TOPS-20: EDIT, TV, and EDT-20. Other editors which are not supported by DIGITAL, such as EMACS and SED, may be installed on your system.


5.1.1 EDIT

EDIT is a line-oriented editor. With a line-oriented editor, you can change a line by referencing the line number, then substituting characters, or by retyping the line. Some computer programming languages use line numbers when giving error messages. Line numbers are also used with some debuggers.

EDIT has an easy-to-learn and simple-to-use command language. You can use EDIT effectively on either a hard-copy or video terminal.

You can use EDIT to create a program and enter it into a file. There are two commands that call the EDIT program:

  1. The CREATE command - to create a file.
  2. The EDIT command - to change a file.

The following sequence shows how to use EDIT to create an ALGOL program that calculates the square root of a number. (If ALGOL is not available on your system, refer to Chapter 9, Producing And Running Your Own Programs, and use the FORTRAN program for the examples).

  1. Type CREATE and press the ESC key. The system prints (FILE).
                     @CREATE (FILE)
  2. Type the filename and file type that you have chosen for your file. For this example, use SQRT.ALG.
  3. Press the RETURN key. EDIT prints the name of the input file and the first line number.
                     @CREATE (FILE) SQRT.ALG<RET>
                     Input:  SQRT.ALG.1

    If you already have a file with this name and type, the generation number will not be 1. To change the filename, press the ESC key; the editor (EDIT) prints an asterisk. Type EQ (End and Quit), and press the RETURN key. The system prints the @. You can then CREATE a new file with a different filename and file type.

  4. Begin typing your program. (If you make a mistake, refer to Section 5.3, Correcting Typing Errors, for assistance.) Press the return key after each line of the program. EDIT automatically types the next line number. The line numbers that EDIT supplies give you reference points to use when you want to edit your file. (See Section C.2.1 in Appendix C).
                     @CREATE (FILE) SQRT.ALG<RET>
                     Input: SQRT.ALG.1
                     00100   BEGIN<RET>
                     00200   REAL X,Y;<RET>
                     00300   WRITE ("[2C] TYPE THE VALUE OF X: [B]");<RET>
                     00400   <TAB>  READ (X);<RET>
                     00500   <TAB>  Y :=SQRT(X);<RET>
                     00600   WRITE ("[C] THE SQUAREROOT OF ");<RET>
                     00700   <TAB>  PRINT (X,3,3);<RET>
                     00800   <TAB>  WRITE (" IS ");<RET>
                     00900   <TAB>  PRINT (Y,3,3);<RET>
  5. Press the ESC key after you type the last character in the last line of your program. This indicates that your file is complete. TOPS-20 returns the dollar sign then an asterisk.
                     01000   END<ESC>$
  6. Type E (for End) and press the RETURN key. EDIT prints the name of your file, saves the file and returns you to the TOPS-20 operating system.

EDIT is fully described in the EDIT User's Guide and the EDIT Reference Manual.


5.1.2 TV

TV is a character-oriented editor. With a character-oriented editor, you can change one or more characters in a line without retyping the line.

TV has a more powerful command language than EDIT. With this command language, you can accomplish complex editing functions with fewer commands.

For the most effective use of TV, you should use a video terminal. TV is described in the TV Editor Manual.


5.1.3 EDT-20

EDT is DIGITAL's standard text editor. It is available on many DIGITAL operating systems, for example, TOPS-20, VAX/VMS, RSTS/E, RSX-11M, and RSX-11M-PLUS. There are only minor differences in the features of EDT found on each of these operating systems.

EDT-20 has three editing modes: keypad, nokeypad, and line. Keypad and nokeypad modes are character-oriented editors for use on video terminals. Line mode can be used on either video or hardcopy terminals but is best used with hardcopy terminals.

EDT provides many features that are not available in EDIT or TV. To name a few, EDT has an on-line help facility, it is customizable, and it allows you to work with several files during a single editing session.

To learn how to use EDT on TOPS-20, refer to the EDT-20 Primer. For a complete description of EDT-20 commands and functions, refer to the EDT-20 Reference Manual. Once you have begun using EDT, the EDT Quick Reference Guide is a summary of EDT commands and functions.


5.2 Defining the logical name EDITOR

To run an editor, type the name of the editor (EDIT, TV or EDT) and press RETURN. TOPS-20 also has three commands for running editors: EDIT, CREATE and PERUSE. These commands run the editor that is defined by the logical name EDITOR:. To determine your system's definition of EDITOR: give the INFORMATION LOGICAL-NAMES command.



If the system definition of EDITOR: is not the editor you have chosen to use, make your own definition of EDITOR: with the DEFINE command:


Because this command is only in effect until you LOGOUT, you should place it in your LOGIN.CMD file so that it will take effect every time you log in.


5.3 Correcting typing errors

As you type your program, you may need to correct typing errors. You can correct your program lines by typing CTRL/U or by pressing the DELETE key.

Section 2.7 describes other ways to correct typing errors.

You CAN use the DELETE key to correct mistyped TOPS-20 commands. If you incorrectly type LOGOUT, for example, but notice the mistake before you press the RETURN key, you can use the DELETE key to fix the error. Section 2.7.1 contains further information about correcting commands with the DELETE key.