(edited 2-Apr-91, Chapter 4) (Using the Keypad Editor (KED)\int_ked_chap)

This chapter provides a brief introduction to the KED editor and shows you how to: (unnumbered) Create text files and inspect and edit existing text files. Use the on-line help facility. Store and retrieve text files. Use a few basic KED features, such as setting line wrap and screen width and how to turn on journal file protection.

The information in this chapter also applies to KEX, which is the default editor for the mapped monitors. KEX is a virtual KED program, so its functions and commands are the same and provide the same operations as the KED functions and commands.

Most of the information in this chapter and additional information in the (ked_book) are summarized in the (kedc_book). (Software Requirements\ked_files_sec)

To run the KED editor, you need the file KED.SAV or KEX.SAV on your system (SY) volume. (unnumbered) If you are using a mapped monitor, use KEX.SAV. If you are using any other monitor, use KED.SAV.

Verify that KED.SAV or KEX.SAV is on your system volume: (.)(DIRECTORY SY:KE%.SAV (RET))

If KED.SAV or KEX.SAV is not on your system volume, copy it to there. (Introduction to KED\ked_intro_sec)

KED is an interactive editor. You type text into a file as though your terminal is an electric typewriter. You can push combinations of keypad and keyboard keys to move the cursor through the file and manipulate the text. The results of text entry and manipulation operations are displayed on your terminal screen as they happen. (Basic KED Operations)

Basic KED operations can be divided into the following three catagories: (unnumbered) Creating text files

This operation involves creating the original version of a text file. Inspecting (displaying) existing text files

This operation lets you examine the contents of an existing text file but prohibits you from making any additions or changes to the file, thus ensuring the integrity of the file. Editing existing text files

This operation lets you make additions and changes to an existing text file. KED copies the existing text file to a temporary file location and all editing is performed on the temporary file. The temporary file you are editing is made permanent only after you explicitly close it. At that point, the previous version of the file is preserved as a backup copy. Therefore, you need not worry about somehow ruining an existing text file while editing it, because you are in fact editing a copy of the existing file. You explicitly close the temporary file and make it permanent by exiting from the file with the EXIT command.

As a further safeguard, you can stop the editing process and throw away the temporary copy of the existing file by quiting the editing process and not explicitly closing the temporary file. You throw away the temporary file (and therefore lose all edits) by exiting from the file with the QUIT command. (Keypad Function Keys)

You use the keypad keys to move the cursor through text files and manipulate text. The keypad function keys are located on the right side of your keyboard.

The following diagram illustrates the relationship between the legend on the actual keypad keys and KED function for each key. The diagram also appears on the front of the (kedc_book). Many users place the reference card diagram near the terminal screen until the key legend/function relationship is learned.

Examine the diagram but do not worry now about remembering the key legend/function relationship. You will use most of the KED keypad functions in this chapter and the relationship between each keypad key legend and its KED function is presented throughout the chapter. The keypad key legend is included parenthetically next to the function.

(POSTSCRIPT\MLO-003502.PS\20) (Creating a Text File\ked_cre_sec)

You create a text file by issuing the EDIT command with the /CREATE option and specifying the file you want to create. Issue the following command to create the text file WEEK.TXT. Because the command line does not include a device specification, WEEK.TXT is created on your default data (DK) volume. (.)(EDIT/CREATE WEEK.TXT (RET))

Your terminal screen clears and you see a blinking cursor at the beginning of the text file. (Using On-Line Help\ked_help_sec)

The KED editor includes an on-line help function. The keypad key marked (PF2) is the HELP key.

Press (HELP).

The display on your terminal screen is replaced with the first HELP screen, containing a display of the keypad function keys. The HELP key provides a handy reference to the keypad function keys. Each box in the display corresponds to a keypad key.

The HELP screen shows that many of the keypad keys can perform two functions: (unnumbered) Standard function

The standard function, indicated in the top half of the box, is performed by pressing the key alone. Alternate function

A second, or alternate function, is indicated in the lower half of the box.

In the display, note the GOLD key in the upper left corner. The GOLD key (marked PF1 on your keypad) is the KED alternate function key. The GOLD key is displayed in a different rendition (darker, lighter, or a different color) than the other keys. Each key's alternate function is indicated in the same rendition as the GOLD key, and the alternate function is performed by sequentially pressing the GOLD key and then the function key.

You can return to displaying your text file by pressing (ENTER), but instead again press (HELP). KED displays another information screen, containing commands that are issued from within KED (as opposed to RT--11 DCL commands). Again, you can return at any time to displaying your text file by pressing (ENTER). Instead, repeatedly press (HELP), displaying more screens. The final information screen illustrates KED functions that are a combination of the GOLD key and various keyboard keys.

If you again press the HELP key, KED displays the original keypad screen. Instead, press (ENTER) to return to your text file. (Entering Text\ked_txt_sec)

You have now created and entered the file WEEK.TXT. The cursor is resting at the beginning of the file. Although not apparent, the cursor is also resting at the end of the text file. To make that fact more apparent, press (RETURN) a few times and then press ( (UPARROW) ) a couple of times. Note a mark is left at the furthest point in the file to which the cursor advanced; that mark is the end-of-file marker. The size of the file expands as necessary to contain entered text or space.

Press the keypad sequence (GOLD) (TOP) ( (PF1) ( 5 ) ), which returns the cursor to the beginning of the file. Type the following text, using () to correct any mistakes and (RETURN) to advance to the next line. (Monday was cold and rainy.) (On Tuesday, it snowed.) (Wednesday was sunny and warm.)

Now, press (RETURN) sufficient times for the text you typed to scroll off the top of the screen, thereby simulating a more typical size file. Press (CTRL/L), thereby entering a form feed (page separation character).

Type the following text: ((F\F)) (Here's a new page.)

Press (RETURN) often enough for the form-feed symbol ((F\F)) to scroll off the top of the screen. Then, type the following text and press (RETURN): (On Thursday, the lilacs bloomed. (RET))

The cursor rests at the beginning of the line below the text.

Finally, consolidate the space at the end of the file by pressing the keypad key (DELLINE) ( (PF4) ) until the terminal beeps. Press (HELP) ( (PF2) ). KED displays a message indicating you have deleted all the empty space beyond the last text line and then attempted to delete a nonexistent line. (Doing this consolidation is required here only to ensure your example text file ends at a known place, and is not normally performed.)

You can exit from a file with the cursor at any position in the file. Now, exit from KED and preserve the file WEEK.TXT on volume DK.

Press the keypad sequence (GOLD) (COMMAND) ( (PF1) ( 7 ) ) and issue the EXIT command in response to the command prompt: ((GOLD) (COMMAND)) (Command:)(EXIT (ENTER)) (.)

Verify that the file WEEK.TXT exists on your default data (DK) volume: (.)(DIRECTORY WEEK.TXT (RET)) (Inspecting an Existing Text File\ked_insp_sec)

You open a text file for inspection by issuing the EDIT command with the /INSPECT option for the specified file. Open the file WEEK.TXT for inspection: (.)(EDIT/INSPECT WEEK.TXT (RET))

KED displays: (M)onday was cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm.

Because WEEK.TXT is opened for inspection only, any attempt to alter the file causes the terminal to beep. If KED is unable to perform any operation you request, your terminal signals with a beep. If you are unsure what caused the terminal to beep, you can press (HELP) ( (PF2) ), and KED displays a short message indicating the reason.

Although WEEK.TXT is open for inspection and cannot be edited, you can use the keypad keys to move the cursor and thereby inspect the file. The keypad contains two keys that govern the direction of cursor movement, (ADVANCE) ( ( 4 ) ) and (BACKUP) ( ( 5 ) ). Initially, the cursor movement is ADVANCE, which continues to apply until explicitly changed.

You can move the cursor by character, word, line, section, page, or length of file. Perform the following keystrokes to move the cursor through the file. Although single keystrokes are used, repeating the keystroke repeats the cursor movement. The cursor is currently resting at the beginning of the file: (M)onday was cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm.

Move the cursor one character position by pressing (CHAR) ( ( 3 ) ): M(o)nday was cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm.

Move the cursor one word position by pressing (WORD) ( ( 1 ) ): Monday (w)as cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm.

Move the cursor one line position by either pressing (BLINE) ( ( 0 ) ) to advance to the beginning of the next line Monday was cold and rainy. (O)n Tuesday, it snowed. Wednesday was sunny and warm.

or by pressing (EOL) ( ( 2 ) ) to move the cursor to the end of the line: Monday was cold and rainy. On Tuesday, it snowed.() Wednesday was sunny and warm.

Move the cursor to the next form feed by pressing (PAGE) ( ( 7 ) ): (F\F) (H)ere's a new page.

Move the cursor to the end-of-file marker by pressing (GOLD) (ADVANCE) ( (PF1) ( 4 ) ): On Thursday, the lilacs bloomed. _

You have been advancing from the beginning to the end of WEEK.TXT because KED initially sets cursor movement direction to ADVANCE. Now press keypad key (BACKUP) ( ( 5 ) ) to redirect cursor movement toward the beginning of the file. You only need to press (BACKUP) once; cursor movement direction remains in effect until changed.

Press (SECTION) ( ( 8 ) ) to demonstrate moving the cursor one section (16 lines).

Finally, perform a search operation by pressing (GOLD) (FIND) ( (PF1) (PF3) ). Respond to the prompt as follows, where (BACKUP) is ( 5 ): (Model:)( monday (BACKUP))

KED searches back through WEEK.TXT for the first occurrence of the target string (monday) and places the cursor at the beginning of the target string: (M)onday was cold and rainy.

If KED is unable to find the target string, the terminal beeps.

When you have finished inspecting WEEK.TXT, you can exit from KED. There is no output file to close because this is a file inspection. Issue the commands: ((GOLD) (COMMAND)) (Command:)( EXIT (ENTER)) (.) (Editing an Existing Text File\ked_edit_sec)

You open an existing text file for editing by issuing the EDIT command and specifying the file. The file must not be protected. Open the file WEEK.TXT for editing: (.)(EDIT WEEK.TXT (RET))

Your terminal screen clears and you see a blinking cursor at the beginning of the text file: (M)onday was cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm.

You can press (HELP) to display the on-line help screens and press (ENTER) to return to the text file.

In (ked_insp_sec), you learned to move the cursor through the file. In this section, you will learn to manipulate text by using the keypad function keys. Text manipulation operations involve moving the cursor to a portion of text and then manipulating the existing text and/or adding new text. Like cursor movement operations, text manipulation also involves units of characters, words, lines, sections, and pages. The search function is helpful for placing the cursor at known points (targets) where you want to edit a file or for determining if a target string exists in a file.

As in previous sections, the legend on the keypad keys is included parenthetically with the function name in the following exercises.

The first part of the exercise involves searching for the following line, editing the line, and then adding the line to the first section of text. This is the line: On Thursday, the lilacs bloomed.

Do this exercise: (numbered) Perform a search operation for the shortest unambiguous portion of the target string. You do not have to search for the first part of the string, but rather get to the general area. Therefore, a good target to search for would be the string (thur), as follows: ((GOLD) (FIND))( (or))( (PF1) (PF3)) (Model:)( thur (ADVANCE))( (or))(( 4 ))

Those commands produce the following display: On (T)hursday, the lilacs bloomed. Assume you want to change the word (lilacs) to (roses). Do the following: (alphabetic) Press (WORD) ( ( 1 ) ) two times, producing: On Thursday, the (l)ilacs bloomed. Press (DELWORD) ( ( - ) ). The word (lilacs) is deleted.

To demonstrate the restoration function, restore the deleted word. Press (GOLD) (UNDELWORD) ( (PF1) ( - ) ) and see that (lilacs) returns.

Restoring deleted text elements is a general procedure. Text elements such as characters, words, and lines, are deleted by pressing a function key. The text element can be restored by subsequently pressing (GOLD) and the function key that deleted the element. This is because a deleted text element is stored in a buffer, and the most recently stored text element can be restored from the buffer.

Again press (DELWORD) and delete (lilacs). Now, type (roses) and press the space bar, producing the following line: On Thursday, the roses (b)loomed. Press (BACKUP) (BLINE) ( ( 5 ) ( 0 ) ) to move the cursor to the beginning of the text line. The following functions (cut) the line out of the file and place the line in the (paste buffer): ((SELECT) (EOL) (CUT))( (or))( ( . ) ( 2 ) ( 6 )) The following functions move the cursor to the beginning of the file: ((GOLD) (BACKUP))( (or))( (PF1) ( 5 )) (M)onday was cold and rainy. Assuming that (Thursday)'s line should follow (Wednesday), press (FORWARD) ( ( 4 ) ) to redirect cursor movement, then press (BLINE) ( ( 0 ) ) three times. The cursor now rests on the first open line. The procedure now (pastes) the line we cut out and placed in the paste buffer on the open line: ((GOLD) (PASTE))( (or))( (PF1) ( 6 ))

The first four lines of text in the file now read: Monday was cold and rainy. On Tuesday, it snowed. Wednesday was sunny and warm. On Thursday, the roses bloomed._

The next part of this exercise replaces the line following the form feed, as follows: (numbered) Press (ADVANCE) (PAGE) ( ( 4 ) ( 7 ) ), which displays the following text: (F\F) (H)ere's a new page. Delete the line by pressing (DELLINE) ( (PF4) ). Type in the following line: (Welcome to new england.) Recognizing that (new england) should start with upper case letters, correct that error, using the following keypad functions and typing the letters N and E: ((BACKUP) (WORD) (WORD))( (or))( ( 5 ) ( 1 ) ( 1 )) ((CTRL/U) (ADVANCE) (WORD) (CTRL/U) )( (or))( (CTRL/U) ( 4 ) ( 1 ) (CTRL/U) )

The line now reads: Welcome to New E(n)gland.

Exit from KED and preserve the output file: ((GOLD) (COMMAND))( (or))( (PF1) ( 7 )) (Command:)( EXIT (ENTER)) (.)

Two versions of the text file now exist on your default data (DK) volume, WEEK.TXT and WEEK.BAK. Verify that by issuing the following command: (.)(DIRECTORY WEEK.* (RET))

The file WEEK.TXT is the result of your most recent editing. The file WEEK.BAK is the previous version.

If your system has a printer, print WEEK.TXT: (.)(PRINT WEEK.TXT (RET))

The first page of the file is the poetry. The second page of the file, caused by the form feed you entered when you created WEEK.TXT, is a statement you could have deduced from the poetry. (Other Useful Features\ked_ofeat_sec)

KED provides many useful features, as described in the (ked_book). The following brief list describes those features that may be helpful when performing exercises in other chapters in this manual. A more complete description of these features is found in (ked_book). (Line Wrap)

KED provides a SET WRAP command that forces a RETURN when text will exceed a specified right margin value. Using SET WRAP lets you type text without being concerned that the text will extend beyond the visible right margin -- extend off your terminal screen.

You enable the SET WRAP feature as follows: (numbered) While running KED, press (GOLD) (COMMAND) ( (PF1) ( 7 ) ). Determine which right margin value you want to specify. You cannot specify a value higher than 78. In response to the command prompt, issue the SET WRAP command for the value you want, such as 70: (Command:)( SET WRAP 70 (ENTER))

If you want to subsequently disable the line wrap feature, press (GOLD) (COMMAND) ( (PF1) ( 7 ) ) and issue: (Command:)( SET NOWRAP (ENTER)) (Screen Width)

You can determine how many columns are displayed on your terminal screen. By default, KED displays 80 columns. You can issue a KED command that changes the display to 132 columns. This feature is especially useful when inspecting program listings, which typically extend beyond column 80.

To change the screen width from 80 to 132 columns: (numbered) While running KED, press (GOLD) (COMMAND) ( (PF1) ( 7 ) ). In response to the command prompt, issue the following command: (Command:)( SET SCREEN 132 (ENTER)) When you want to return to the 80-column display (the 132-column display is difficult to read), press (GOLD) (COMMAND) ( (PF1) ( 7 )) and issue the following: (Command:)( SET SCREEN 80 (ENTER)) (Keeping a Journal File)

You can protect the file you are creating or editing by keeping a journal file. KED maintains a continuously updated copy of changes and additions you make to a file, so if you experience an unplanned power-down or other system malfunction, you can recover your file.

You keep a journal file by coupling the /JOURNAL option with the EDIT command (and other options). For example, assuming the example file WEEK.TXT, you create WEEK.TXT and keep a journal file with the following command: (.)(EDIT/CREATE/JOURNAL WEEK.TXT (RET))

You edit WEEK.TXT and keep a journal file with: (.)(EDIT/JOURNAL WEEK.TXT (RET))

If an unplanned power-down or other system malfunction occurs, you recover the created or edited WEEK.TXT by using the /RECOVER option: (.)(EDIT/RECOVER WEEK.TXT (RET)) (Other Features Described in This Manual)

KED is a powerful editor. The (ked_book) describes many KED features that you will find useful. Also, in (mon_part) of this manual, you will find information on: (unnumbered) How to run the mapped monitor version of KED (KEX) as a system job. How to run multiple copies of KEX at the same time and instantly go from one file to another. How to easily move text from one file to another. (Chapter Summary)

The following basic KED editing functions and commands were described in this chapter: (unnumbered) Obtaining the on-line help screens:

Press (PF2) Creating text files: EDIT/CREATE filespec Inspecting text files: EDIT/INSPECT filespec Edit existing text files: EDIT filespec Obtaining journal file protection: EDIT/CREATE/JOURNAL filespec

or: EDIT/JOURNAL filespec Performing the journal file recovery operation: EDIT/RECOVER filespec