![]() |
![]() |
Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Module 5: User Commands![]() Lesson 1 UDCs and Command Files |
|
Lesson 1 presents a review of command files and an introduction to UDCs. You will learn how to:
"User command" is a term for a user-specified short-hand command that causes one or more MPE/iX commands to execute. Here are some samples of user commands. The names of the user commands are the choice of the user. User MPE/iX Command Commands LF-------->LISTFILE PR-------->PRINT SM-------->SHOWME SJ-------->SHOWJOB SHOW------>SHOWME & SHOWJOB As you know from previously creating command files, their main purpose is to save users time and keystrokes when executing MPE/iX commands. There are two types of user command: command files and user- defined commands, called UDCs. Both command files and UDCs have the following features:
UDCs, however, are sophisticated command files that have some added features and differ in various ways from command files:
Consider how the command files listed previously would appear as UDCs in a UDC file, MYUDC1. Some of the differences you will notice are:
There are many user benefits to using a command file for user commands. First, command files are immediately executable after being kept. UDC files must be cataloged before they will execute. Second, command files can be easily modified and, if necessary, purged. UDC files must first be uncataloged to be modified, and then recataloged to be executable again. UDCs cannot be purged while they are cataloged. Third, because command files are easy to use, many users create their UDCs initially as command files. After they are sure that the file "works," users transform the command file to a UDC file. Despite the added effort to create and catalog UDC files, they provide some features unavailable with command files. One advantage is the order of execution. Commands stored in a UDC file execute before those stored in a command file. (You will learn about search and execution priorities in Lesson 2.) Another important advantage is that UDCs can use a logon option that allows the UDC to execute immediately upon the user's logon. Yet another advantage of UDCs is that a UDC file is opened only once, and then any of the UDCs within it are available for access at any time. (In the case of command files, every time you call a command file, it must be opened.) UDCs use less disk space than the same number of individual command files. They may also provide better organization of user commands since they are all contained in the same file. Finally, UDC files have an additional safety feature — they cannot be easily purged accidentally. Consider the UDC files in your account. UDC files must be cataloged in order for the UDCs to execute. This is done with the SETCATALOG command. All cataloged files are displayed with the command:
Enter that command now from your keyboard.
Do you get the following listing of your UDC files? You should see the fully qualified file name for MYUDC1 and these UDCs:
Study the UDC file, MYUDC1. To list the contents of a UDC file, enter:
Do that now for MYUDC1.
Here's what you should see on your screen: STARTUP OPTION LOGON SHOWJOB SETEQ *** SETEQ FILE IN=$STDIN FILE OUT=$STDLIST FILE OUTPUT=TESTFILE;REC=-80,,F,ASCII FILE MAILPRNT;DEV=LP;ENV=ELITE.HPENV.SYS FILE SLLIST;DEV=TAPE *** SHOWCAT SHOWCATALOG *** SM SHOWME *** SJ SHOWJOB *** As mentioned earlier, UDC files may contain one or more UDCs with the individual UDCs separated by asterisks. (Remember? No asterisks are included in command files.) How many UDCs are in MYUDC1?> If you said five, you're right. STARTUP, SETEQ, SHOWCAT, SM, and SJ are the five UDCs contained in MYUDC1. Each UDC begins with its command header or UDC name, for example, STARTUP, followed by commands to be executed. (Command files are executed by their file name; UDCs are executed by their command header.) How could you ensure that a UDC would go into effect automatically when you log on? If you insert a line OPTION LOGON following the command header, the UDC executes when you log on. The logon option is useful for displaying information regarding your current session, specifically the number of jobs and sessions currently running on your system. UDC files can use OPTION LOGON, but command files cannot. Which of the UDCs in the MYUDC1 file goes into effect when you log on? If you log on again, you should notice that the SHOWJOB command automatically executes. There may be times when you want to look at a UDC to find out which commands are included. But what if you don't know under which UDC file name the UDC was cataloged? Then you can use the HELP command to list the contents of individual UDCs. For example, to list the contents of a UDC called SETEQ, you would enter:
UDCs can also be used to set up file equations. By including your most common file equations in a UDC, you can avoid retyping the equations every time you want to use them. Instead, you only need to execute that UDC.
********** End of Exercise 5-1 *********** |