HPlogo Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Module 5: User Commands

Lesson 3 Cataloging UDCs

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Introduction

Lesson 3 covers the following topics dealing with cataloging UDCs for use:

  • cataloging process

  • SETCATALOG command

  • APPEND option of SETCATALOG

  • DELETE option of SETCATALOG

  • uncataloging UDCs

Reviewing UDCs

Before you begin cataloging UDCs, see how much you remember.

What command lists the currently cataloged UDCs and the files in which they reside?

   SHOWCATALOG

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.

Creating or modifying a UDC

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.

NOTE: Typically, you create a command file first to test your user command. When it works as planned, you may wish to add it to an existing UDC file. Command files are easier to modify than UDCs, so in an environment where change is common, you may wish to use command files instead of UDCs.

For example, suppose you want to create a UDC that lets you change your group to PUB by entering:

   CHPUB

You might first test the command by creating a command file named CHPUB. Create such a command file with only one line:

   CHGROUP PUB

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:

   CHGROUP CLASS

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:

   SETCATALOG

Do a SHOWCATALOG to verify that no user UDC files are cataloged. (System UDC files remain cataloged).

NOTE: Entering a SETCATALOG command without any file name uncatalogs all your UDC files. This means that the UDC files are removed from the UDC directory. They are not purged from the system!

Invoke an editor, and edit the MYUDC1 file to add the CHPUB and CHCLASS UDCs:

   CHPUB

   CHGROUP PUB

   ***

   CHCLASS

   CHGROUP CLASS

   ***

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:

   SETCATALOG MYUDC1

Now reexecute the CHPUB command. Are you back in the PUB group? Of course!

Use the CHCLASS command to return to your CLASS group.

Cataloging and uncataloging UDC files

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:

   SETCATALOG udcfile1, udcfile2, ... udcfilex

When you want to uncatalog your UDC files (the ones which are currently cataloged), the SETCATALOG command syntax is even simpler:

   SETCATALOG

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:

   SETCATALOG MYUDC2

Adding UDC files

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:

   SETCATALOG udcfile;APPEND

To illustrate this option, type:

   SETCATALOG MYUDC1;APPEND

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:

   SETCATA MYUDC3

Verify the effect of this UDC by using SHOWCATALOG.

MYUDC1, MYUDC2 and MYUDC3 should all be cataloged.

Figure 6-5 SETCATALOG APPEND Option

[SETCATALOG APPEND Option]

Deleting UDC files

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.

   SETCATALOG UDCfilename;DELETE

You may remove one or more UDC files from the catalog. To remove more than one, use this form:

   SETCATALOG UDCfilename1, UDCfilename2...;DELETE

When you remove one or more UDC files from the catalog, the remaining files stay in the catalog, undisturbed.

Q5-4

If the files TOKYO, LONDON, DALLAS, and LIMA were cataloged UDC files in the UDC directory, how would you do the following?

  1. delete all the UDC files from the UDC directory?

  2. add the UDC files MOSCOW, NAIROBI, and BRASILIA to the UDC directory without affecting other cataloged files?

  3. replace existing UDC files in your UDC directory with the following files: NEWYORK, BOSTON, BOMBAY, and ZURICH?

  4. remove BOSTON and BOMBAY from the UDC directory without affecting any other UDC files.

Lesson summary

  1. The following commands are used when dealing with UDC files:

    • SETCATALOG UDCfilename - catalogs one or more UDC files. (These files replace whatever files were previously cataloged.)

    • SETCATALOG Return - uncatalogs all UDC files.

    • SETCATALOG UDCfilename(s);APPEND - catalogs one or more UDC files byadding them to the UDC directory. (Files which were previously cataloged are still cataloged).

    • SETCATALOG UDCfilename(s);DELETE - uncatalogs one ore more UDC files by removing them from the UDC directory (the remaining files remain cataloged).

  2. Before you edit a UDC file, you must uncatalog it.