Lesson 1 Using Command Files [ Using the 900 Series HP 3000: Fundamental Skills Module 6: Command Files ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Fundamental Skills Module 6: Command Files
Lesson 1 Using Command Files
Lesson 1 presents creating and using command files.
* what is a command file is
* how to create and use a command file
* command files that execute other command files
What is a command file?
A command file:
* is a text file, just like any text file that you create
* may contain MPE/iX commands, program file names, and the names of
other command files
* executes the commands, programs, or other command files that are
named inside it
Creating and executing command files
At its simplest, a command file is an MPE/iX command that you shorten.
For example, instead of typing in the whole command SHOWTIME, that you
can use the editor to create a command file called ST that contains the
command SHOWTIME. You save it and leave the editor. Every time that you
enter STReturn at the system prompt, SHOWTIME executes.
Get into the editor. Create a one-line file. The only line that you
need is SHOWTIME.
It will look like this on the screen:
________________________________________________________________________
| |
| |
| /ADD |
| |
| |
| 1 SHOWTIME |
| 2 // |
| /KEEP ST |
| /EXIT |
| |
________________________________________________________________________
You have a command file called ST.
Enter:
STReturn
What happens on the screen?
Another example of a one-line command file is PR. It prints the last
three lines of the file DOCUMENT to the terminal screen. (Of course, you
would have difficulty if the file has fewer than three lines.)
Get into the editor now. Create a new file by doing the following:
ADDReturn
PRINT FILE=DOCUMENT;START=-3Return
//Return
KEEP PRReturn
Exit the editor.
Execute the command file PR by doing the following:
PRReturn
You should see on the screen the last three lines of the file DOCUMENT
that you created in module 3.
Suppose that you created a command file that has this one line:
LISTFILE @.PUB
What would this command file do?
This command file would list all of the files in the PUB group of your
account. If this file were to be kept as PUBLIST, look at how many
keystrokes that you would save each time this command file was executed.
Create and execute this command file, PUBLIST.
Command files that execute other command files
One command file can call upon and execute another command file. The
example below shows what that you might put in a command file named PS.
It executes the command file PR and then executes the command file ST.
Try it. Create the file in the editor, just as it appears below.
________________________________________________________________________
| |
| |
| 1 PR |
| 2 st |
| |
________________________________________________________________________
Save the file as PS and exit out of the editor.
To execute it, enter the following:
PSReturn
Do you see the last three lines of the DOCUMENT file and the date and
time on the screen?
NOTE If an error message occurs while you are trying to execute a
command file, check the contents of the file first for command line
syntax errors.
MPE/iX 5.0 Documentation