|
|
Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 4 Creating Text FilesLesson 4 More About the Editor |
|
Lesson 4 presents these useful text-related tasks:
When you are editing one file, you can add the contents of another file to the file you are working on by using the JOIN command. This process is often called appending. The JOIN command expects you to specify the following:
Use the editor to create a three-line file by typing the following:
Exit out of the add line mode by typing the following:
Now, save this file as DRAFT by entering:
Use
Now start a file that looks like the following:
Again, stop adding lines with //Return. Save this file as DRAFT2 by entering:
Make sure that you are in the editor's command mode. To do a quick check to see if both files are saved to disk, you can execute the system command LISTFILE from within the editor. At the editor prompt, enter:
Did you enter a colon (:) ahead of the LISTFILE command? You must do it that way. It will look something like this on the screen:
Clear the workspace by entering:
Now that you know the DRAFT and DRAFT2 files exist, join DRAFT to the end of the file DRAFT2. Text in DRAFT2 by entering:
Then enter:
It will look like this on the screen:
The contents of DRAFT that are appended to the end of DRAFT2, on lines 6, 7, and 8, appear on the screen. To see all of the file, enter:
You should see this:
In this exercise, you did not specify where to put DRAFT, so the editor made the assumption that you wanted to put it at the end (appending). Keep the joined file of DRAFT and DRAFT2 as a file named NEWDRAFT.
Clear the editor's workspace by entering
By specifying a line number with JOIN, you can add one file from the disk anywhere in the body of the file you are working on. Try it. Text in DRAFT. Enter:
To see the combined file, enter:
The contents of DRAFT2 were inserted, creating new lines between line 1 and line 2. Notice that the added lines have increments of 0.1. Keep this file as NXTDRAFT.
Some programs won't allow you to execute a system command while the program is running. There may be times when you need to get to the system prompt (:) to access MPE/iX commands. Fortunately, most Hewlett-Packard programs do allow you to suspend program operations in order to execute a command, and most allow you to resume operation of the program without losing your place. Try this exercise from within the editor. Once again, clear the editor's workspace. Enter:
Text in the DRAFT.
Enter:
Add the following lines:
Note the line number that you are on (6) and remember that you are still in the Add mode. Locate the Break key on your keyboard and press it. Your screen should look like this:
You won't see Break on the screen. Notice that the system prompt has returned. Pressing Break forces the suspension of the editor. You can now communicate directly with the MPE/iX system. You are in Break mode.
Use SHOWTIME to get the date and time from the system. It should look like this on the screen:
The RESUME command continues the operation of a program or command that has been suspended. The program or command resumes its action exactly where it left off when you pressed Break.
Now enter:
Does this appear on the screen?
This is what is happening:
When you pressed Break you were in Add mode. And when you tell MPE/iX to resume, it returns to the editor's Add mode. The computer is waiting for you to do one of two things:
To continue typing a line, enter this:
This line becomes line 6, because you were on line 6 when you broke off line editing with Break. You cannot see the line number yet, but do you see that the editor is now ready for you to type line 7? Now, type the following on line 7, but do not press Return at the end of the line.
At the end of line 7, press Break. Here is the sequence as it occurs on the screen (Break and the Return keys are invisible, of course):
Pressing Break obliterates line 7. In the editor, pressing Break when the cursor is on a line of text prevents the computer from ever receiving that line. Get out of Break by typing RESUME. Press Return and get out of the Add mode of the editor. Type the following to look at your file:
Every program has its own way of allowing you to stop the program. For the editor, the command is END, EXIT, or E. The ABORT command allows you to terminate the program without using the program-specific stop command. ABORT provides an emergency exit.
Press Break Enter:
Here is what happens on the screen:
If you now try
RESUME will not work. You will see this on the screen:
By executing ABORT, you have stopped the editor in its tracks. The only way to get back to the editor now is to start it all over again.
The editor does its best to ensure against emergencies that would compromise your current work. It even regards a Break or an ABORT command as a small emergency. To protect the work that you are doing, it creates K files while you are working on a text file. Here is how it works. Enter:
Look closely at the file names. Did you get something like this on the screen?
You should have one or more files that begin with the letter K, followed by seven digits. The K file appeared because you used the Break key while you were working on DRAFT. The K files that appear on your screen have different numbers from the ones shown above.
The K file saved on your disk is the most current version of the file DRAFT. Notice, though, that another, older version of DRAFT is still on the disk. All seven digits following the K have a meaning. They tell you when the file was created. If an emergency arises (if the power goes out, for instance), look at the clock. Note the time. Table 4-3 The K Numbers
Using these numbers, you can identify the file. On what day and at what time was the file K0592305 created? If you answered February 28, at 11:05 P.M., you were right! The editor creates a new K file every time that you start a new file, text in an existing file for editing, or join one file to another file. If you are creating a new file, there is nothing in the K file at first. If you are texting in an existing file, then the K file consists of whatever was in the existing file (on the disk) when you issued the TEXT command to bring the file into the editor workspace. The editor adds new lines to the K file as you add lines to the work file that you see displayed on the screen. That means that if the power goes out, or you use BreakABORTReturn, your file will be saved in a K file on the disk. Try this procedure to recover K files:
|
|