Calc utility

The calc utility provides an interface to the MTA&#x27;s internal expression parser and evaluator. Additional function "sets" can be added by specifying appropriate switches, e.g., the -mm switch provides access to the Sieve function set.

Syntax
imsimta calc &#x5b;expression&#x5d;

Restrictions
None.

Prompts
 

The expression to evaluate.

Description
The  utility is a calculator,  for performing integer and string operations. See Operators in Order of Precedence  for a list of basic arithmetic and symbolic operators available, and  Symbol table functions for a list of  functions available.

Variables can be created, and values assigned to them, using the " " assignment operator, e.g., calc&#x3e; a = 3 Use Ctrl-D to exit.

In addition to its use for performing simple calculations, the  utility may also be helpful for testing planned use of calculations in Sieve filters, or in expressions inside MTA mapping tables. Compared with the   utility, the   utility is simpler for testing the fundamentals of mathematical calculation or string manipulation, but does not test, for instance, Sieve filter-specific syntax.

,  (default)
The  switch may be used to enable debug output. Specifying  is equivalent to specifying.

,
( new in MS 6.2;   new in MS  6.3.) The   and   switches must be  used in order to use   or. With , specify the envelope From address (for instance,  for purposes of Sieve filter evaluation). If not specified, the MTA&#x27;s default postmaster return address is assumed. If   is not specified, then   has no effect. With , specify the envelope To address.

,  (default)
The  switch may be used to specify a file from  which to read the expressions to be evaluated.

,  (default)
Initialize the MTA as if for message submission of the specified message. The  switch must be used in order to use. When  is used, the    switch and   switch also become  available.

,  (default)
If specified, loads the Sieve function set. This causes an MTA initialization call to be made. Use of any of the,   , or   switches requires  that   also be specified. The  and    switches are mutually exclusive (they cannot be used  with each other).

,
(New in MS 8.0)    takes a required integer  argument specifying the initial MT-PRIORITY value. It may only be specified when   has also been specified.

(default),
The default,, allows evaluating multiple,  comma-separated statements per physical line. Specifying   disables this, so that only the first result  (from the physical line) is returned.

,  (default)
The  switch may be used to specify a file to  which to write the output of the calculator.

(default),
(New in MS 6.2.) The  switch must be used in  order to use.

(New in MS 8.0) Specify the recall secret.

(New in MS 8.0)  Specify the source channel; the default is    (the "L"ocal channel).

 is a bit-encoded integer. The default is. But note that specifying   forces setting bit 9 (value 512), overriding whether or not    set that bit, to allow bracketed lists.

See the  utility&#x27;s description of  Statement parsing flags for details on the meaning of the bits for this switch&#x27;s value.

To test Sieve scripts using the " " construct   or (new in MS 8.0)  " " construct, note that   must  be specified.

,  (default)
The  switch, if specified, enables references to environment variables. is the default.

,  (default)
(New in MS 7.0.5)  The   switch must be used in order  to use. If  is specified with  , then the Sieve is treated as a  system-level Sieve; if  not, then it is treated as a  user-level Sieve.

The  switch controls the interpretation of unassigned  variables. The default is.

See also:
 * Sieve filters
 * Mapping tables
 * return_address MTA Option
 * Sieve loop extension
 * Sieve subroutines
 * Sieve hierarchy
 * test -expression utility
 * MTA command line utilities