MPE/iX Shell and Utilities Reference Manual, Vol 1

dc(1) MPE/iX Shell and Utilities dc(1)
<x pops two values off the stack. If the first popped value is less than the second, dc
executes the contents of register x as a string of commands.
!<x pops two values off the stack. If the first popped value is not less than the second, dc
executes the contents of register x as a string of commands.
=x pops two values off the stack. If the first popped value is equal to the second, dc
executes the contents of register x as a string of commands.
!=x pops two values off the stack. If these two values are not equal, dc executes the con-
tents of register x as a string of commands.
One string may execute another. For example, a string being executed via the x command
may contain a > construction to execute a register string if the condition holds true. In this
case, dc executes the new string, then returns to the old string to continue executing where it
left off. A string may execute a string which executes another string, and so on. Because of
this possibility, dc keeps a stack of the strings that it is currently executing.
When dc finds a q command inside a string being executed, it doesn’t quit dc. Instead, it
quits executing the current string, plus the string that caused the execution of the current
string. In other words, it pops two strings off the currently executing stack.
To see why you want to quit the two most recent strings, consider the following example.
[q]sy
loads a quit command into register y. Now, we might use something like
[... la lb >y ...]
to quit in the middle of the string if the value in register b is greater than the value in register
a. The command >y executes the command string in register y if the condition is true; if the
quit command in y only stopped one command string, it would quit executing the commands
from y and go right back to executing the main command string. To be able to use this tech-
nique to quit the main command string, the q command must pop two command strings.
The Q (uppercase) command is a variation on the simple q command. Q pops the top number
off the (value) stack and stops execution of that many currently executing strings. For
example,
3Q
stops the three most recent executing strings.
Array Operations
As noted previously, arrays are similar to registers in that they have names consisting of a
single character. However, a register’s array values are independent of it’s scalar value; the
array element X[1] for example, is different than the scalar X.
1-162 Commands and Utilities