NBSpool for MPE Reference Guide
Chapter 2
2-14
Variable Substitution
NBSpool will substitute JCWs and MPE/iX variables into a command string. To insert a value of a
variable into a command, preface the JCW or variable name with an exclamation point. For
example, to insert the value or variable of the JCW
PRI into an ALTER command, enter:
O> ALTER $,MGR.SPOOL;P=!PRI
If a variable name is specified but not found, no substitution will be made. Furthermore, using two
exclamation points will prevent the insertion of a value. In the example shown below, the
ALTER
command will search for the string !TEST. Each pair of exclamation points will be converted to
1
,
but only if the character following the last
!
is an alphabetic character. Otherwise, all of the
exclamation points will be left in the command string.
O> ALTER $,”!!TEST”
For MPE/iX users, a general discussion on the use of variable substitution can be found by entering
HELP ECHO,EXAMPLE.
Notes on Using Variables
• If a session has a variable called
PREV, using the !PREV subset will fail, as the value of the
variable
PREV will be inserted in the command. To avoid this problem, modify the command
line to use a subset of
!PREV. This will ensure the use of the !PREV subset in all cases.
• When entering
XEQ commands, make sure all variables are defined and valid before entering
the
XEQ command list. The XEQ command parses each command as it is entered, so an error
will occur if a variable isn’t found.
• Each time a command is executed, the value of all variables will be looked up. This allows an
XEQ command to change the value of a variable and have it take effect on all subsequent
commands.
• Variables are not substituted in MPE commands.