HP 3000 Manuals

Lesson 9: Dereferencing Variables [ MPE V to MPE XL: Getting Started ] MPE/iX 5.0 Documentation


MPE V to MPE XL: Getting Started

Lesson 9:  Dereferencing Variables 

MPE XL variables are dereferenced by placing an exclamation point before
the variable name.  In the following example, a user created variable is
dereferenced in an ECHO statement.
____________________________________________________________________
|                                                                  |
|                                                                  |
|      :SETVAR x, "BLUE"                                           |
|      :echo !x is best.                                           |
|      BLUE is best.                                               |
|                                                                  |
____________________________________________________________________

In executing the ECHO command above, the system dereferences the variable
x, displaying its value (BLUE) rather than its name (x).

You can also dereference system variables.  For instance, suppose you
want a quick reminder of what time you started your session.  You could
create the following command file, naming it something like START.

     ECHO Session started at !HPINTROTIME.

Each time you executed this file, the system would dereference the system
variable HPINTROTIME and display its value on the screen.
___________________________________________________________________
|                                                                 |
|                                                                 |
|      :START                                                     |
|      Session started at 10:07 AM.                               |
|                                                                 |
___________________________________________________________________

Exercises 

15.  Create and execute a command file that creates a variable and then
     dereferences that variable in an ECHO statement.

16.  Create and execute another command file that uses a system variable
     in an ECHO statement.



MPE/iX 5.0 Documentation