|
|
Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 4 Creating Text FilesLesson 3 Editing a Text File |
|
Lesson 3 presents the commands that permit you to do the following:
Using the editor, you have learned to create and save files.
To print a file from the editor, the file first must be brought into the work area. Get into the editor and at the / prompt enter:
The TEXT command instructs the computer to find the specified file, and, if it exists, to put it into the editor's workspace for printing or for file editing. To display the entire DOCUMENT file to your screen, enter:
This file should look very familiar to you by now. With a slight change, the LIST or L command prints the file on your line printer. To send the file that you are working on to the printer, enter:
You should eventually see this message on the screen:
This tells you the computer has started working on your command. If your printer is busy, your file might take a while to print. It may take a few more moments before the editor prompt (/) reappears on the screen. Its reappearance tells that you the file is on its way to the line printer.
You can also print a single line:
This would print line 1. Or you can print a range of lines:
This would print lines 2, 3, 4, and 5. The paper copy of your file is called a printout, hard copy, or listing. Your listing can be easily distinguished from other users' listings by the header (front) and trailer (back) pages of your listing. Your logon identifier appears several times across these pages. Go pick up your listing. Did your file not print out? Your system manager or someone else may have created another standardized way of indicating a line printer or some other printing device. If so, using OFFLINE might not succeed. Ask your account manager for the correct way to indicate the line printer for this use of the editor LIST command. The ADD command automatically begins adding lines at the end of the existing file, no matter where the end of the file is found. From within the editor, display the entire DOCUMENT file:
Next enter:
This brings a new, blank line labeled 7 onto the screen. You are now ready for typing. Add the following lines 7 through 10 to your file:
Your screen is probably cluttered, but your display should show this:
What if you want to add text in the middle of a file? Using ADD with a line number starts a new line immediately after the number you have specified. Enter:
and at 6.1 type the following:
Enter:
Your screen should look like this:
Notice that to insert new lines between line 6 and line 7, the editor added the new lines with increments of 0.1 (one-tenth). It can also add lines in increments of 0.01 or 0.001. The editor would allow you to do this (but do not do this now):
The editor would let you start typing on line 6.001 and then on 6.002 and then on 6.003, and so on. When you got to line 6.009, the editor would increment the line count to 6.01. Using increments of 0.001, the editor could add as many as 999 new lines between line 6 and line 7. If you need still more lines, you can use the GATHER ALL command to renumber the lines. Then add lines where you want them. Make sure you are in command mode. The DELETE or D command erases a line or a range of lines. Try entering
It should appear this way on the screen:
DELETE displays the line that you erased. Use LIST ALLReturn to verify that the line has been erased. To delete a series of consecutive lines, use DELETE and specify the line range you wish to erase. In the following example, lines 7 through 10 of your document are erased. Try this and see what happens:
The GATHER ALL command instructs the editor to renumber lines. That's useful when you have added lines between lines and the numbering scheme begins to get out of hand. Try this:
You should see the following:
Now the line numbers are neat and tidy. Notice that you can now add lines between line 6 and line 7 and have the increment start with 0.1 all over again. The GATHER command lets you move one or more lines from one place to another. Enter this:
You will see this:
The editor displays the number of the line being moved and shows the line number where it will appear (line 1.1). Use LIST ALLReturn to verify that line 7 has been moved to line 1.1 and that line 7 has disappeared. You should see this:
Do you notice? To move line 7 between lines 1 and 2, you used the GATHER command to move line 7 to line 1.1. How would you move lines 3 through 5 directly under line 1.1?
The 3/5 tells the editor to move lines 3 through 5. Try it. What happens? Enter:
What do you see? Moving the lines has jumbled the meaning of the text. And you now have line numbers with decimals. It would be useful to renumber the lines. Do this:
Then use
What happens? The GATHER ALL command instructs the editor to renumber lines lines of the work file. That becomes useful when you have added or moved lines between lines and the numbering scheme threatens to get out of hand. Save the file. Enter:
The editor already knows the name of the file, so you do not have to specify a file name this time. (If you specified a different file name — KEEP DOCFILE — the editor would know that you wanted to keep your work under a new file name.) So you should see this on the screen:
Enter:
Use the MODIFY command to edit lines of text. For example: MODIFY 22 tells the computer to let you edit line 22, if there is a line 22. Do you recall the commands used with the REDO command in module 1 to edit command lines? The MODIFY command in the editor uses three of the same commands: D, I, and R.
Like REDO, MODIFY retrieves a line for correction.
Enter:
Then type the following line, exactly as shown, to the end of the DOCUMENT file:
Now, enter the following:
Using the D, I, and R commands of MODIFY, correct the line above to read as follows:
Follow the editing step by step.
Notice:
Unlike the REDO command, the MODIFY command lets you modify blocks of text.
Try that, if you like, with the file that you have been working on.
The editor's workspace is an area of computer memory that is separate from and independent of disk memory. So, it is possible to have one version of a file on the disk and edit that same file in the editor's workspace. Naturally, the more you edit the version in the workspace, the more it comes to differ from the version that is saved on the disk. If you wish, you can use KEEP DOCUMENT to save to disk the workspace version of the DOCUMENT file that you have been editing throughout this module. As soon as you do that, the two versions are identical — until you begin more editing on the workspace version; however, if you want to clear the workspace without saving your editing changes, enter:
This erases everything in the editor's workspace memory area, but the file that is kept on disk is unchanged. Because this can have disastrous consequences if typed in error, the EDIT/3000 program gives the following warning:
A NOReturn reply to this warning halts any deletion. Use LIST ALLReturn to verify that there is no file in the editor's workspace. With the editor's workspace completely clear, you could start a new file if you wanted to. To start a new file, you would enter the ADD command:
If there is no file in the workspace (you entered DELETE ALLReturn), then the editor starts a fresh new file with line 1.
|
|