HPlogo Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Working with Files

Lesson 5 Displaying File Contents

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Lesson 5 presents the command to display the contents of text files.

  • the command to display the contents of a text file: PRINT

Up to now you have used the editor to see a file, but you can display the contents of a text file on the screen without starting the editor to text in the file and list it.

You should be in MYGROUP.

Displaying an entire file

To see the contents of DOCUMENT on the screen, use PRINT command this way:

   PRINT DOCUMENTReturn

Displaying selected lines

To see only lines 3 through 6 of the file, enter this:

   PRINT DOCUMENT;START=3;END=6Return
NOTE: Notice the punctuation? The semicolons ( ; ) are needed here.

The PRINT parameters

Here is what happens:

  • START= tells the computer which line of the file to show first.

  • END= tells the computer which line to show last.

  • The semicolons ensure that the computer knows where one parameter ends and another begins.

What do you suppose the following prints to the screen:

   PRINT DOCUMENT;START=-3

Try it.

The last three lines of the file DOCUMENT are printed on the screen. This happens because you specified a minus sign (-) ahead of the number 3, so the instruction becomes: start printing at the third line from the end.

NOTE: New users of MPE/iX should always specify a file name when using the PRINT command. Entering PRINTReturn puts MPE/iX into a create mode, and that causes confusing results on the terminal screen. If you do this by accident, enter :eod (colon included) by itself on a new line and pressReturn.

:EOD (colon included) by itself on a new line sends a message to the computer — End Of Data.

Lesson 5 Exercises

  1. Display the file ACORN to your terminal screen.

  2. Display lines 3 through 7 of the file ACORN to your screen.

  3. What method would you use to print the file ACORN to a line printer?

Feedback to webmaster