Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Module 5: User CommandsLesson 3 Cataloging UDCs |
|
Lesson 3 covers the following topics dealing with cataloging UDCs for use:
Before you begin cataloging UDCs, see how much you remember. What command lists the currently cataloged UDCs and the files in which they reside?
What is the difference between a UDC and a user command file? They are both inherently the same except that the user command file has no header line, and is invoked by its file name. The UDC is invoked by the name listed in its header. Also, a UDC must be part of a UDC file that is cataloged in the UDC directory. To create a UDC, you must first create a UDC file with an editor. Then you can add to it the commands that make up your UDC. (Just make sure all UDCs are separated by asterisks ***.) Another way to create UDCs is to modify or add to the commands in an existing UDC file. Anytime you modify any existing UDC file, you must first uncatalog all UDC files by issuing the command SETCATALOG (without any file name following it). You can then use the text editor to modify the file. After you have saved the file, you must use SETCATALOG again, but this time specify the UDC file you are cataloging. You can then use the UDCs within it.
For example, suppose you want to create a UDC that lets you change your group to PUB by entering:
You might first test the command by creating a command file named CHPUB. Create such a command file with only one line:
Now execute the CHPUB command file. Do a SHOWME to verify that you are in the PUB group. Change back to your CLASS group. You can use the MPE/iX CHGROUP command, or create another command file named CHCLASS to do this. Enter:
Since the CHPUB and CHCLASS commands work, you can add them to one of your UDC files. Do a SHOWCATALOG to see what UDC files are currently cataloged. To add the command to MYUDC1, you have to uncatalog MYUDC1. To do so, type:
Do a SHOWCATALOG to verify that no user UDC files are cataloged. (System UDC files remain cataloged).
Invoke an editor, and edit the MYUDC1 file to add the CHPUB and CHCLASS UDCs:
Keep the UDC file and purge the old CHPUB command file. Now try to execute the CHPUB UDC. Does it work? Of course not! You haven't yet recataloged the UDC file of which CHPUB is a part. Exit the editor and enter:
Now reexecute the CHPUB command. Are you back in the PUB group? Of course! Use the CHCLASS command to return to your CLASS group. As you may have noticed, before a UDC can be used, the UDC file in which it resides must be cataloged in the UDC directory. The SETCATALOG command syntax is quite simple:
When you want to uncatalog your UDC files (the ones which are currently cataloged), the SETCATALOG command syntax is even simpler:
Just leave off the names of the UDC files, and all of the UDC files will be uncataloged. This allows you to edit any of your UDC files and then to catalog them when you're ready. Remember, uncataloging only removes the UDC files from the UDC directory; it does not purge them from the system. Do a SHOWCATALOG to verify that no UDC files are currently cataloged. Now catalog only the MYUDC2 file:
When using the SETCATALOG command you must specify all the UDC files you wish to put in the UDC directory. Each time you use the SETCATALOG command, any UDC files specified replaces those currently in the UDC directory. However, sometimes you may wish to catalog only one UDC file and then add others later. What can you do? You can use the APPEND option:
To illustrate this option, type:
Do a SHOWCATALOG to verify that MYUDC1 and MYUDC2 are cataloged. Whenever you catalog UDC files, remember to use the group name for a UDC file if you try to catalog it from a different group. Notice that MYUDC2 has a special UDC that lets you append UDC files: SETCATA. All you need to do is specify the UDC file you wish appended after the name, SETCATA. Try this command now:
Verify the effect of this UDC by using SHOWCATALOG. MYUDC1, MYUDC2 and MYUDC3 should all be cataloged. SETCATALOG without parameters removes all of your UDC files from the UDC directory. Suppose you want to remove and edit just one of your UDC files? Use the ;DELETE option of the SETCATALOG command.
You may remove one or more UDC files from the catalog. To remove more than one, use this form:
When you remove one or more UDC files from the catalog, the remaining files stay in the catalog, undisturbed.
|