HP 3000 Manuals

Lesson 2: Creating and Displaying Variables [ MPE V to MPE XL: Getting Started ] MPE/iX 5.0 Documentation


MPE V to MPE XL: Getting Started

Lesson 2:  Creating and Displaying Variables 

User created variables must be given values.  Use SETVAR to create and
modify them.  Use SHOWVAR to display them.

They are similar to JCWs, but are more flexible and extensive.  MPE XL
variables can be used interactively in sessions, in jobs, or in programs.
JCWs and variables can be used in both UDCs and command files.

User created variables can contain 32-bit integers, string values,
Boolean values, expressions, or the names of other variables.  Any
process in a job or session can read, change, or delete user created
variables.  They end when the session/job ends.

SETVAR 

[]
The new command SETVAR is used to create variables and to assign values. Using it, create a variable f to equal the value Fred, a variable _e to equal the value eTHEL, a variable k to equal the integer 1024, a variable j to equal the decimal 10.24, and a variable m to equal the Boolean value TRUE, as follows: ___________________________________________________________________ | | | | | SETVAR f, "Fred" | | SETVAR _e, "eTHEL" | | SETVAR k, 1024 | | SETVAR j, "10.24" | | SETVAR m, TRUE | | | ___________________________________________________________________
NOTE MPE XL cannot evaluate numbers unless they are integers. Therefore, you must put quotes around 10.24, treating it as alphanumeric data. Notice, however, that the whole number 1024 and the Boolean value TRUE are specified without quotes.
SHOWVAR To show that these variables were set, use SHOWVAR: _____________________________________________________________________ | | | | | :SHOWVAR | | F = Fred | | _E = eTHEL | | K = 1024 | | J = 10.24 | | M = TRUE | | | _____________________________________________________________________ Entering SHOWVAR alone displays a list of all user created variables defined during a session, and their values. The variables are shown in the order of their creation. You may also specify one or more specific variables in the SHOWVAR command: ____________________________________________________________________ | | | | | :SHOWVAR F,K | | F = Fred | | K = 1024 | | | ____________________________________________________________________ Exercises 2. Set the variable PI to equal the string value 3.14159, and the variable BOND to equal the string value 007. 3. Display the values of PI and BOND.


MPE/iX 5.0 Documentation