Lesson 2 Understanding Search Priority and Search Path [ Using the 900 Series HP 3000: Advanced Skills Module 5: User Commands ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Advanced Skills Module 5: User Commands
Lesson 2 Understanding Search Priority and Search Path
Introduction
This lesson presents information on the following topics:
* MPE/iX search priorities
* the use of the XEQ command
To be sure that your user commands execute, you need to be aware of how
MPE/iX interprets what is entered at the prompt.
How does MPE/iX search for UDCs, commands, programs, and command files?
How does MPE/iX know whether you have entered a command or a UDC, for
example? What is printed if what you have entered is not found in the
search path?
Figure 5-2. MPE/iX Directory Search
MPE/iX interprets everything entered at the prompt to be a command. It
prioritizes its search for that command in the following order:
* UDCs first
* MPE/iX commands second
* file names (including command files and programs) last
This hierarchy is called the search priority.
The following detailed diagram illustrates the process MPE/iX uses to
search for a command called TRYIT.
Figure 5-3. MPE/iX Search Priority
UDC directory
Suppose you were to enter the following at the MPE/iX prompt:
TRYIT
The system would first search for TRYIT in the directory of UDC files.
(This directory is where all cataloged UDCs are kept.) User created UDCs
are searched first, account UDCs next, and system UDCs last. If TRYIT
were a UDC, the search would end and TRYIT would be executed.
In order to put a UDC in the UDC directory, it must be part of a UDC file
that has been cataloged with the SETCATALOG command. SETCATALOG is
described in the next lesson.
--------------------------------------------------------------------------------------------
| |
| Q5-1 Which UDC in each of the following pairs would execute? |
| |
| |
| 1. the user UDC SM or the system UDC SM? |
| |
| 2. the system UDC LF or the account UDC LF? |
| |
| 3. the account UDC TRYIT or the user UDC TRYIT? |
| |
--------------------------------------------------------------------------------------------
Command directory
But what if TRYIT were not found in the UDC directory? Then the search
would continue to see if TRYIT were in the MPE/iX command directory If it
were, the system would execute it.
--------------------------------------------------------------------------------------------
| |
| Q5-2 Suppose one of your cataloged UDCs has the same name as an MPE/iX command. |
| If you enter the name, will the UDC or the MPE/iX command execute? |
| |
| |
--------------------------------------------------------------------------------------------
File directory
If TRYIT were not found in the command directory, the search would
continue on to the file directory. If TRYIT were a qualified file name
of a valid executable file, for example, a command file, TRYIT would
execute.
--------------------------------------------------------------------------------------------
| |
| Q5-3 Suppose you have both a command file and a cataloged UDC with the same name, |
| MYFILEX. When you enter MYFILEX at the prompt, which of these will execute? |
| |
| |
--------------------------------------------------------------------------------------------
Search path
Figure 5-4. Search Path
Since the file name TRYIT has not been qualified, the system follows a
designated search path looking for a matching name.
By default, the system first looks in your current group, next in your
PUB group, and finally in PUB.SYS.
If TRYIT were not found in the search path or were found to be a
nonexecutable file, the system would issue an Error Message and return
you to the MPE/iX prompt.
_________________________________________
| |
| |
| UNKNOWN COMMAND NAME (CIERR 975) |
| |
_________________________________________
XEQ command
Occasionally you may want to have the system execute a command file or
program that has the same name as a UDC. The UDC always executes first
unless you precede the name of the command file or program with the XEQ
command.
The XEQ command ensures execution of valid command files and programs
despite name duplications. XEQ plus
the name of a program causes that file to execute.
For example, suppose you had a UDC and a program file with the same name,
MYFILE.
Entering
MYFILE
executes the UDC.
Entering
XEQ MYFILE
ensures that your program file MYFILE executes.
Lesson summary
1. MPE/iX interprets everything entered at the prompt to be a command
and prioritizes its search for that command as follows:
a. UDCs first
b. MPE/iX commands second
c. file names last
2. Use the XEQ command to ensure that the system executes a command
or program file having the same name as a cataloged UDC.
NOTE XEQ also causes your command file to override any system command of
the same name.
Exercise 5-2:lesson 2 review.
Use the search path diagram in figure 5-3 as a guide. Check your
understanding of search path and execution priority. Which executes?
1. the LISTFILE system command or a command file named LISTFILE?
2. a command file called DELFILE in your PUB group or a program
called DELFILE in your current group?
3. a program called PRINT or the MPE/iX command PRINT?
4. XEQ MYLIST, a command file, or a UDC called MYLIST?
********** End of Exercise 5-2 **********
MPE/iX 5.0 Documentation