Lesson 3 Editing a Text File [ Using the 900 Series HP 3000: Fundamental Skills Module 3: Creating Text Files ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Fundamental Skills Module 3: Creating Text Files
Lesson 3 Editing a Text File
Lesson 3 presents the commands that permit you to do the following:
* open an editor file for editing: TEXT
* print an editor file: LIST
* edit a line: MODIFY
* add new lines to the end of a text file: ADD
* add new lines in the middle of a text file: ADD
* erase a line of text file: DELETE
* renumber lines: GATHER ALL
* move lines: GATHER
* clear the file from the editor's workspace: DELETE ALL
Open an EDIT/3000 file for editing
Using the editor, you have learned to create and save files.
NOTE Before trying this, find out whether your computer is connected to
a printer and where that printer is located.
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:
TEXT DOCUMENTReturn
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:
LIST ALLReturn
This file should look very familiar to you by now.
Sending a file to the printer
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:
LIST ALL, OFFLINEReturn
* The LIST command tells the editor to display the file on the
screen.
* The ALL parameter tells the computer to display all of the file.
* The addition of , OFFLINE tells the computer to send the file (or
lines of the file) not to the screen but to the printer.
You should eventually see this message on the screen:
________________________________________________________________________
| |
| |
| /LIST ALL, OFFLINE |
| *** OFF LINE LISTING BEGUN. *** |
| / |
| |
________________________________________________________________________
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.
NOTE On its way to the line printer:
The printer can handle only one file at a time. If other people
have sent files to the printer--especially if they are long
files--your file might have to wait in line to be printed. Your
file is given a number and is printed in proper order, along with
all of the other waiting files. The order of printouts can be
altered by the system manager.
You can also print a single line:
LIST 1, OFFLINE
This would print line 1.
Or you can print a range of lines:
LIST 2/5, OFFLINE
This would print lines 2, 3, 4, and 5.
Identifying your document.
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.
Problems?.
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.
Adding lines of text:ADD
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:
LIST ALLReturn
Next enter:
ADDReturn
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:
Remember that corrections have to be made one step at a time.Return
After each step you can see what you accomplished by pressingReturn
Return. When you are done, leave the MODIFY step by pressingReturn
Return twice in a row.Return
//Return
Your screen is probably cluttered, but your display should show this:
________________________________________________________________________
| |
| |
| /LIST ALL |
| 1 EDIT/3000 is a hard-working program. Your operator |
| would |
| 2 call it an entire subsystem of your computer operating |
| system. |
| 3 It has dozens of its own commands, some of them |
| quite |
| 4 elaborate. It even uses three REDO subcommands that |
| you |
| 5 used in module 1. |
| 6 The ADD command adds lines at the end of an existing |
| file. |
| /ADD |
| 7 Remember that corrections have to be made one step at a |
| time. |
| 8 After each step you can see what you accomplished by |
| pressing |
| 19 Return. When you are done, leave the MODIFY step by |
| pressing |
| 10 Return twice in a row. |
| 11 // |
| / |
| |
________________________________________________________________________
Adding linesin the middle of a text file: ADD
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:
ADD 6Return
and at 6.1 type the following:
I decided to add more lines in the middle of what I alreadyReturn
had.Return
Return
//Return
Enter:
LIST ALLReturn
Your screen should look like this:
________________________________________________________________________
| |
| |
| 1 EDIT/3000 is a hard-working program. Your operator |
| would |
| 2 call it an entire subsystem of your computer operating |
| system. |
| 3 It has dozens of its own commands, some of them |
| quite |
| 4 elaborate. It even uses three REDO subcommands that |
| you |
| 5 used in module 1. |
| 6 The ADD command adds lines at the end of an existing |
| file. |
| 6.1 I decided to add more lines in the middle of what I |
| already |
| 6.2 had. |
| 6.3 |
| 7 Remember that corrections have to be made one step at a |
| time. |
| 8 After each step you can see what you accomplished by |
| pressing |
| 9 Return. When you are done, leave the MODIFY step by |
| pressing |
| 10 Return twice in a row. |
| |
________________________________________________________________________
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):
/ADD 6.001
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.
Erase a line: DELETE
Make sure you are in command mode.
The DELETE or D command erases a line or a range of lines.
Try entering
DELETE 6.2Return
It should appear this way on the screen:
________________________________________________________________________
| |
| |
| /DELETE 6.2 |
| 6.2 had. |
| |
________________________________________________________________________
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:
DELETE 7/10Return
Renumbering lines:GATHER ALL
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:
GATHER ALLReturn
LIST ALLReturn
You should see the following:
________________________________________________________________________
| |
| |
| 1 EDIT/3000 is a hard-working program. Your operator |
| would |
| 2 call it an entire subsystem of your computer operating |
| system. |
| 3 It has dozens of its own commands, some of them |
| quite |
| 4 elaborate. It even uses three REDO subcommands that |
| you |
| 5 used in module 1. |
| 6 The ADD command adds lines at the end of an existing |
| file. |
| 7 I decided to add more lines in the middle of what I |
| already |
| 8 |
| |
________________________________________________________________________
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.
Moving lines:GATHER
The GATHER command lets you move one or more lines from one place to
another.
Enter this:
GATHER 7 TO 1.1Return
You will see this:
________________________________________________________________________
| |
| |
| /GATHER 7 TO 1.1 |
| 7 => 1.1 |
| |
________________________________________________________________________
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:
________________________________________________________________________
| |
| |
| 1 EDIT/3000 is a hard-working program. Your operator |
| would |
| 1.1 I decided to add more lines in the middle of what I |
| already |
| 2 call it an entire subsystem of your computer operating |
| system. |
| 3 It has dozens of its own commands, some of them |
| quite |
| 4 elaborate. It even uses three REDO subcommands that |
| you |
| 5 used in module 1. |
| 6 The ADD command adds lines at the end of an existing |
| file. |
| 8 |
| |
________________________________________________________________________
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?
GATHER 3/5 TO 1.2Return
The 3/5 tells the editor to move lines 3 through 5.
Try it. What happens?
Enter:
LIST ALLReturn
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.
Renumbering lines
Do this:
GATHER ALLReturn
Then use
LIST ALLReturn
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:
KEEPReturn
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:
________________________________________________________________________
| |
| |
| DOCUMENT |
| DOCUMENT ALREADY EXISTS - RESPOND YES TO PURGE OLD AND KEEP |
| NEW |
| PURGE OLD? |
| |
________________________________________________________________________
Enter:
YESReturn
Editing a text line:MODIFY
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.
MODIFY Works Like REDO.
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.
D Deletes the character above it.
DDDD erases four characters, the ones above each D.
I Inserts character(s) above the I.
R Replaces character(s) above the R with new
character(s).
Like REDO, MODIFY retrieves a line for correction.
STEP 1. Make one correction on the line.
STEP 2. Press Return.
Pressing Return once displays the line again for another
correction.
STEP 3. If the line is now correct, press Return again.
Pressing Return twice in a row signals the end of your
corrections on that particular line.
If the line is still not correct, go to STEP 4.
STEP 4. Make another correction on the line. Go to STEP 3.
Enter:
ADDReturn
Then type the following line, exactly as shown, to the end of the
DOCUMENT file:
SAVE is used to save alll or prt of the work file.Return
//Return
Now, enter the following:
MODIFY 9Return
Using the D, I, and R commands of MODIFY, correct the line above to read
as follows:
KEEP is used to save all or part of the work file.
Follow the editing step by step.
/MODIFY 9
9 SAVE is used to save alll or prt of the work file.
RKEEPReturn
9 KEEP is used to save alll or prt of the work file.
dReturn
9 KEEP is used to save all or prt of the work file.
iaReturn
9 KEEP is used to save all or part of the work file.
Return
Notice:
* The editor prompts you for the changes that you want to make.
* When the line is correct, press Return again to tell the editor to
accept the line the way it is.
Unlike the REDO command, the MODIFY command lets you modify blocks of
text.
* You could enter MODIFY 1/4 to edit lines 1 through 4.
* The computer would first display line 1 for editing.
* When you finish editing line 1 and press Return twice, the editor
displays line 2 for editing, and so on.
Try that, if you like, with the file that you have been working on.
Starting a new editor file:DELETE ALL
NOTE Read this lesson completely before performing any of the following.
Then, if you like, go back to do the practice exercises.
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:
DELETE ALLReturn
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:
________________________________________________________________________
| |
| |
| IF IT IS OK TO CLEAR RESPOND "YES" |
| CLEAR? |
| |
________________________________________________________________________
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:
ADDReturn
If there is no file in the workspace (you entered DELETE ALLReturn), then
the editor starts a fresh new file with line 1.
MPE/iX 5.0 Documentation