HPlogo Command Interpreter Access and Variables Programmer's Guide: Series HP 3000 Computer Systems > Chapter 2 Accessing the Command Interpreter

Issuing Commands Through UDCs

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A user-defined command (UDC) saves time and reduces errors. It allows a commonly used command string or multiple command strings to be issued with a single entry.

Creating a UDC File

A UDC file is a specially identified file containing one or more UDCs. Each UDC is composed of a unique name, required and optional parameter specifications, selected options controlling its execution, and one or more command lines. In a UDC file, each UDC is separated from the next by a line of one or more asterisks beginning in column 1. You can use any editor to create a UDC file. The following example shows multiple UDCs in a single file.

   SJ

   OPTION LOGON

   SHOWJOB

   *****

   LF

   LISTFILE

   *****

   ABXYZ A,B=B

   OPTION LIST

   RUN !A.PUB.SYS

   RUN !B.PUB.SYS

   RUN XYZ

   *****

   CF1

   CMDFL1

   *****

To distinguish a UDC file from other files, it must be cataloged, using the SETCATALOG command. This process identifies the contents of the file as UDCs, so that any UDC name within the file is interpreted as a command by the CI. UDC files can be created at the user level, the account level, or the system level. UDCs can be added to or deleted from an existing UDC file, but must be uncataloged first. (Refer to the self-paced tutorial Using the 900 Series HP 3000: Fundamental Skills (32650-60037) for details about cataloging, adding to, and deleting from a UDC file.)

Executing a UDC

The UDC file in the preceding example contains four UDCs. The user can enter a UDC name and parameters, if appropriate, at the CI prompt to execute its associated routine. For example, by entering LF at the CI prompt, the UDC named LF is executed. Its associated commands execute the LISTFILE command.

When executing a command, the CI first searches cataloged UDC files for a UDC name that matches the command string. UDC files are searched in the following sequence:

  1. User-level UDCs.

  2. Account-level UDCs.

  3. System-level UDCs.

If the specified command does not match a UDC name, the built-in MPE/iX commands are searched. UDCs, therefore, provide a method of superceding standard MPE/iX commands.

NOTE: When a UDC or command file is used to invoke a program while in BREAK from another program invoked from within a UDC or command file, MPE/iX returns CIERR 9065.

Specifying UDC Options

Several options are available to control UDC processing. These options are especially useful to programmers to allow or prohibit certain features. (Refer to the self-paced tutorial Using the 900 Series HP 3000: Fundamental Skills (32650-60037) for a detailed description of each UDC option.)

LIST or NOLIST

Controls the display of each command image as it is executed.

HELP or NOHELP

Controls the ability to display the contents of the UDC in help mode.

BREAK or NOBREAK

Controls the ability to stop execution of a UDC.

LOGON or NOLOGON

Controls the automatic execution of a UDC at logon.

RECURSION or NORECURSION

Controls the search for UDCs called from another UDC.

PROGRAM or NOPROGRAM

Controls the ability of a UDC to be executed from a program.

The contents of a UDC can be listed as each command is executed using the LIST option. All or any portion of the UDC can be kept from listing by specifying the NOLIST option. The NOLIST option is often used to eliminate unnecessary display or to maintain security. The NOHELP option similarly limits the listing of a UDC's contents within the Help facility.

The NOBREAK option limits the ability of the user to break the processing of UDC commands. This option is often used to protect a series of processing steps or to ensure that an error procedure is completed. The NOBREAK option is also used as a security measure by keeping the user from gaining control of the CI by breaking a procedure.

UDCs can be invoked automatically when the user logs on to the system if the LOGON option is set. This feature can be used to restrict users to a particular application environment or to automatically perform a routine commonly performed at the beginning of a session. In the previous example, the first UDC (SJ) contains the logon option. This UDC is performed automatically when you log on. Your logon is followed immediately by the list of all active jobs, the output of the SHOWJOB command. The CI prompt is displayed following the job display. Note that only one UDC in the UDC file can contain the LOGON option.

The search for a UDC starts at the beginning of the search sequence to the point where a matching UDC name is encountered. If one UDC is called from another, the search for the second UDC begins where the previous search ended. The RECURSION option provides a method of specifying that the search must start at the beginning of the standard search sequence.

The NOPROGRAM option controls UDC calls from an application program. A UDC can be executed through the HPCICOMMAND intrinsic if the PROGRAM option is specified in the UDC. This option is often used to control execution of UDCs and built-in commands that have the same name.

Feedback to webmaster