HP 3000 Manuals

Programmatic Access to the Command Interpreter [ Getting Started as an MPE/iX Programmer Programmer's Guide ] MPE/iX 5.0 Documentation


Getting Started as an MPE/iX Programmer Programmer's Guide

Programmatic Access to the Command Interpreter 

Three intrinsics, COMMAND, HPCICOMMAND, and MYCOMMAND, allow programmatic
use of the MPE/iX command interpreter (CI). They allow a program other
than the CI to:

   *   Perform system services (for example, building and purging files).

   *   Use the entire MPE/iX CI command set, command files, and UDCs.

   *   Parse MPE/iX commands.

Some interactive subsystems can programmatically perform these functions
without first having to exit their specific subsystem environment (that
is, enter break mode).

The intrinsics for programmatic use of the CI are:

   *   COMMAND, which provides access to the MPE V/E subset of CI
       commands.

   *   HPCICOMMAND, which provides programmatic access to most of the
       MPE/iX CI command set, command files, and UDCs.

   *   MYCOMMAND, which provides a programmatic ability to parse a line
       and return one or more of its parameters.

Command files and user-defined commands (UDCs) are files that allow
programmers to develop their own environment.  These are discussed in
Chapter 1.  For detailed information on command files and UDCs, refer
to Command Interpreter Access and Variables Programmer's Guide 
(32650-90011).

Concatenating Strings and String Substitution 

You can concatenate a string with a prefix or suffix.  String
substitution in a Command File or a UDC parameter takes precedence over
substitution of Command Interpreter-level variables.  For example,

          :SETVAR x 1
     :WHILE  x < 10 DO
        :PURGE ACCT!x
        :SETVAR x x+1
     :ENDWHILE
     :DELETEVAR x

purges files ACCT1, ACCT2,..., ACCT9.

Expression Evaluation 

You can specify an expression in a Command File or a UDC parameter and an
appropriate value will be assigned to it.

Using Job Control Words (JCWs) 

A Job Control Word (JCW) is one type of predefined variable.  On MPE/iX,
JCWs are a subset of session-level variables, restricted by values and
naming conventions.  MPE/iX stores JCWs as integers in the session-level
variable table.  You can manipulate JCWs with

   *   JCW commands and intrinsics
   *   Variable commands and intrinsics
   *   IF command

The commands SETJCW and SHOWJCW correspond to the commands SETVAR and
SHOWVAR used on standard variables.  DELETEVAR is used to delete JCWs.
The intrinsics GETJCW and PUTJCW correspond to the intrinsics HPCIGETVAR
and HPCIPUTVAR used on CI variables.  MPE/iX distinguishes between the
table entries created by the SETJCW command (or the PUTJCW intrinsic) and
those created by the SETVAR command (or the HPCIPUTVAR intrinsic).

JCW commands and intrinsics usually function like the corresponding
variable commands and intrinsics, with a few exceptions, described below.

Job Control Word Name and Type.   

A JCW name can be a maximum of 255 characters long.  The first character
must be alphabetic.  Other characters can be alphabetic or numeric.  A
JCW name cannot contain the underscore (_) or the wildcard parameters (#,
?, [, and ]).  A JCW must be of type integer, with a value in the range 0
to 65535.  This is the only difference between JCW names and variable
names.  For detailed information on naming and dereferencing variables,
refer to Command Interpreter Access and Variables Programmer's Guide 
(32650-90011).

Changing the Value of a JCW.   

Once created, you can change the value of a JCW by using variable or JCW
commands and intrinsics.  If you assign a value to a JCW that is outside
the valid JCW range, then MPE/iX reclassifies it as a standard variable
when you assign such a string value to it.  You can no longer use JCW
commands and intrinsics on it; you must use variable commands
and intrinsics to display, change, or delete it.  You can force
reclassification of a JCW by assigning it a large numeric value.  For
example,

          SETJCW X 99

defines a variable named X as a JCW with value 99.

The statement:

          SETVAR X 400

gives X the new value of 400, but X remains a JCW. However, when you
assign a string value ABC to X with the statement:

          SETVAR X "ABC"

then X becomes a variable and not a JCW. MPE/iX informs you of the change
with the message:

          JCW HAS BEEN RE-CLASSIFIED AS A STANDARD VARIABLE

JCW and CIERROR.   

Two special session-level JCWs named JCW and CIERROR are also system
JCWs.  Therefore, they cannot be reclassified as session-level variables
or deleted.  You can change their values with the SETVAR and HPCIPUTVAR
commands, but only to assign a new value in the legal range for JCWs.  If
you attempt to assign a value outside the range, MPE/iX issues the
message:

        THE VALUE MUST BE AN INTEGER IN THE RANGE 0...65535

and the initial value remains unchanged.

Reserved-word Prefixes.   

JCWs with reserved-word prefixes and numeric values are:

          SYSTEM     49152
          FATAL      32768
          WARNING    16384
          OK         0

Help Facility 

The MPE/iX Help facility is available for commands, User-Defined Commands
(UDCs), command files, and program files.  Command files and UDCs have
two special options for the Help facility:  HELP and NOHELP. NOHELP
disables the Help facility to provide increased security for UDCs and
command files.  When NOHELP is active, you can execute a UDC or Command
File, but cannot display its contents.  HELP is the default option.  For
detailed information on this topic, refer to Command Interpreter Access 
and Variables Programmer's Guide (32650-90011).



MPE/iX 5.0 Documentation