HPlogo Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 4 Creating Text Files

Lesson 4 More About the Editor

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Lesson 4 presents these useful text-related tasks:

  • the command to join files together: JOIN

  • executing MPE/iX commands from within the editor

  • using the BREAK key to suspend a program or command

  • EDIT/3000 safety files ( K files) and how to recover them

Joining files together: JOIN

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:

  • which file you want added to the one that you are working on

  • where you want the file added (at the beginning, at the end, or somewhere in the middle)

Use the editor to create a three-line file by typing the following:

   This is line 1 of the file DRAFT.Return

   This is the second line of DRAFT.Return

   This is the last line of DRAFT.Return

Exit out of the add line mode by typing the following:

   //Return

Now, save this file as DRAFT by entering:

   KEEP DRAFTReturn

Use

   DELETE ALLReturn

Now start a file that looks like the following:

   This is the file DRAFT2.Return

   This is a very short file.Return

   This is line 3.Return

   This is line 4.Return

   This is the end of the file DRAFT2.Return

Again, stop adding lines with //Return. Save this file as DRAFT2 by entering:

   KEEP DRAFT2Return

Listing files from within the editor

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:

   :LISTFILEReturn

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:

   /:LISTFILE



   FILENAME



   DOCUMENT     DRAFT      DRAFT2      K1901102



   /
NOTE: LISTFILE is not an editor command, but an MPE/iX command. Putting a colon (:) ahead of the command tells the editor to execute an MPE/iX command.

Not all MPE/iX commands can be executed from within a program, and not all programs allow you to execute MPE/iX commands. For information about commands, refer to the online help facility. For information about a program or application, refer to the documentation for the program or application in question.

Clear the workspace by entering:

   DELETE ALLReturn
NOTE: Remember that clearing the editor workspace erases the area of memory that the computer is using for your current editing. It does not clear the screen. Refer to table 2-1 in module 2.

Joining at the end

Now that you know the DRAFT and DRAFT2 files exist, join DRAFT to the end of the file DRAFT2.

Text in DRAFT2 by entering:

   TEXT DRAFT2Return

Then enter:

   JOIN DRAFTReturn

It will look like this on the screen:

   /TEXT DRAFT2

   /JOIN DRAFT

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:

   LIST ALLReturn.

You should see this:

   /LIST ALL

       1     This is the file DRAFT2.

       2     This is a very short file.

       3     This is line 3.

       4     This is line 4.

       5     This is the end of the file DRAFT2.

       6     This is line 1 of the file DRAFT.

       7     This is the second line of DRAFT.

       8     This is the last line of DRAFT.

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.

   KEEP NEWDRAFTReturn

Clear the editor's workspace by entering

   DELETE ALLReturn

Joining in the middle

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:

   TEXT DRAFTReturn

   JOIN DRAFT2 TO 1.1Return

To see the combined file, enter:

   LIST ALLReturn

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.

   KEEP NXTDRAFTReturn

Suspending EDIT/3000: the Break key

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.

Using the Break key

Try this exercise from within the editor. Once again, clear the editor's workspace.

Enter:

   DELETE ALLReturn

Text in the DRAFT.

   TEXT DRAFTReturn

Enter:

   ADDReturn

Add the following lines:

   Once upon a midnight drearyReturn

   While I pondered weak and wearyReturn

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:

   /ADD

   4   Once upon a midnight dreary

   5   While I pondered weak and weary

   6   Break

   :

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.

NOTE: Not all programs or commands can be suspended with Break. Some commands ignore Break and proceed to their conclusion. The online help facility indicates which commands are breakable.

Use SHOWTIME to get the date and time from the system.

It should look like this on the screen:

   :SHOWTIME

   FRI, JUL 27, 1990,  4:58 PM

   :

Continuing a Program: RESUME

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.

NOTE: Not all programs or commands can be continued with RESUME. Some commands terminate when you press Break.

Now enter:

   RESUMEReturn

Does this appear on the screen?

   :RESUME

   READ pending

This is what is happening:

  • The RESUME command tells the computer to pick up where it left off with the editor (or whatever it was doing when you pressed Break).

  • the READ pending message means that the computer is waiting for you to do something, but it may not be clear what it is waiting for.

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:

  • continue typing a line

  • signal the start of a new line by pressing Return

To continue typing a line, enter this:

   Another line came back, ready for more editing.Return

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.

   I am going to type another sentence now.

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):

   /ADD

       4     Once upon a midnight dreary

       5     While I pondered weak and weary

       6     BREAK

   :SHOWTIMEReturn

   FRI, JUL 27, 1990,  4:58 PM

   :RESUMEReturn

   READ pending

   Another line came back, ready for more editingReturn

       7     I am going to type another sentence nowBreak

   :

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:

   LIST ALL

Use ABORT after BREAK to stop

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.

NOTE: ABORT can be used only after you press Break.

Press Break

Enter:

   ABORTReturn

Here is what happens on the screen:

   :ABORT

   PROGRAM ABORTED PER USER REQUEST.  (CIERR 989)

   :

If you now try

   RESUMEReturn

RESUME will not work.

You will see this on the screen:

   :RESUME

   COMMAND ONLY ALLOWED IN BREAK. (CIERR 1686)

   :_

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.

CAUTION: Do not use ABORT to end programs. An ill timed ABORT can destroy information that you might want to keep.

Safety files: K files

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:

   LISTFILEReturn

Look closely at the file names. Did you get something like this on the screen?

   :LISTFILE



   FILENAME



   DOCUMENT     DRAFT    DRAFT2     K1901052    K1901102

   NEWDRAFT     NXTDRAFT

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 is the editor's safeguard against emergencies.

  • If an emergency comes up (a loss of power, an ABORT, or an interruption such as Break) the file that you are working on is saved with the K name.

  • The K name consists of the letter K and a series of numbers that record the date and time.

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.

What the numbers mean

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

 What they mean
K1901052The last four digits (1052) tell you that the time (24-hour style) when you created the file. This one was created at 10:52 A.M.
K1901052The first three digits (190) tell that you the file was created on the 190th day of the year of the Julian calendar (for example, January 1 would be 001, January 2 would 002, and so on).

 

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!

What is saved in a K file

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.

Recovering a K file

Try this procedure to recover K files:

  • Start the editor if you are not already in it.

  • Enter:

       :LISTFILEReturn
    

    Look for a file beginning with K and ending with 7 numbers.

  • Use TEXT to put the K file into the editor's workspace (for example, TEXT K1901052Return). The following message appears on the screen:

       ***WARNING*** TEXT FILE IS NOW WORK FILE.
    
  • Use LIST ALLReturn to see the file's contents.

  • Use KEEP with a file name of your choice to save the file, KEEP KFILEReturn, or whatever valid file name you like.

  • Leave the editor.

NOTE: If your management treats K files as temporary files, your operator probably erases them from the disk regularly. If so, examine any K files that appear in your group. Decide whether to recover them (with a new name) or whether to let your operator purge them.

Lesson 4 Exercises

  1. Suppose that you have two disk files, one named FILE1, the other FILE2. Assume that FILE1 is in the editor's workspace.

    1. What would you type at the editor prompt to join FILE2 to the end of FILE1?

    2. What would you type at the editor prompt to join FILE2 to line 1.2 of FILE1?

  2. How would you get a listing of the files kept to disk from within the editor? What would you type at the editor prompt?

  3. If you are in the middle of a program and need to get to the MPE XL prompt, without exiting the program, what key would you press?

  4. What MPE/iX command gets you back into the editor after you suspend the editor, as you did in answering the preceding question?

  5. After suspending a program using the Break key, which MPE/iX command terminates the program that has been "broken" out of?

  6. On what day and at what time were the following K-files created?

    1. K3651230

    2. K0020815

    3. K0321152

    4. K0152300

NOTE: Have you taken a break to relax? This might be a good time.
Feedback to webmaster