<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://m204wiki.rocketsoftware.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SSmirnova</id>
	<title>m204wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://m204wiki.rocketsoftware.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SSmirnova"/>
	<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=Special:Contributions/SSmirnova"/>
	<updated>2026-04-17T08:11:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=Using_variables_and_values_in_computation&amp;diff=104473</id>
		<title>Using variables and values in computation</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=Using_variables_and_values_in_computation&amp;diff=104473"/>
		<updated>2017-10-19T18:41:33Z</updated>

		<summary type="html">&lt;p&gt;SSmirnova: /* Understanding Initial processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;toclimit-3&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL lets you use variables to represent values. You can use a SOUL variable, called percent variable (%variable), because variable names must start with a percent sign, any place in a SOUL statement that requires a value.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can declare %variables for a single value or as an array. For the purposes of discussing SOUL, the term %variable is used to mean both a %variable and an element of a %variable array.&lt;br /&gt;
The features discussed in this article enable you to generate additional information based on data in the file.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Special types of variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In addition to the basic %variables (and variable arrays) discussed in this article, SOUL provides the following types of variables:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Type of variable &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;See...&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Field name &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; [[#Field name variables|Field name variables]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Screen variables &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Full-screen feature#Full-screen variables|Full-screen variables]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Image variables &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Images#Defining image items|Defining image items]] and the sections that follow describing types of images&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;%Variables as parameters &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Flow of control in User Language]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Values===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can specify SOUL values by using:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Literals (quoted strings)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Numeric constants &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Field values (values derived from field retrievals)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;%Variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL performs value conversions on values, as described in this article.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic operations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Using values and/or %variables, you can construct expressions to perform arithmetic operations, which are discussed in this article.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Default variable attributes==&lt;br /&gt;
 &lt;br /&gt;
===Model 204 parameters that set default attributes for variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
[[#Model 204 parameters that set default attributes for variables|Model 204 parameters that set default attributes for variables]] lists three &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; parameters that establish the default type, length, and number of decimal places for all types of SOUL variables:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;%variable parameters&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Parameter&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Default&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VTYPE&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Type: &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;, or &amp;lt;var&amp;gt;Undefined&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VLEN&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Length of &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;20&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VDP&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Number of decimal places in &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;0&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can change the defaults established by these parameters as follows:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The values of VTYPE, VLEN, and/or VDP can be changed by any user for the duration of the terminal session with the &amp;lt;var&amp;gt;RESET&amp;lt;/var&amp;gt; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The value of any of these parameters can be overridden for the duration of a request with the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The variable type, length, and/or number of decimal places for any given variable can be explicitly specified in the declaration statement for that variable. This has the effect of overriding the respective values established by VTYPE, VLEN, and VDP, as well as the values established by the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
VTYPE, VLEN, and VDP are discussed where relevant elsewhere in this article. Also, refer to the&lt;br /&gt;
[[List of Model 204 parameters]] and [[List of Model 204 commands]] for more on user parameters.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Relationship between default values and variable declarations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A variable can be declared:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explicitly, in a declaration statement (see [[#DECLARE statements for %variables|DECLARE statements for %variables]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Implicitly, in an assignment statement (see [[#Assignment statements|Assignment statements]]). When a variable is declared implicitly, it takes on the attributes established by the VTYPE, VLEN, and VDP parameters (as modified by any &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement that may precede the assignment statement).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variables Are statement===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement overrides, for the remainder of the current request, the default variable type, length, and/or number of decimal places established by the VTYPE, VLEN, and/or VDP parameters, or by an earlier &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. It is particularly useful if you don&#039;t want to rely on VTYPE, VLEN, and VDP, and when most of the %variables used in a request are of the same type and length.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; declaration has no effect on variables which have been declared (either implicitly or explicitly) earlier in the request. The defaults established by a &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement remain in effect until the next &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; declaration or until the end of the request, whichever comes first.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The format of the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Variables Are &lt;br /&gt;
 {Fixed [Dp &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] | Float | String [Len &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] [Dp {&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt; | *}] &lt;br /&gt;
 | Undefined}&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Variables Are Undefined statement====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement forces you to explicitly declare all variables. If this statement is used in a request and &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; encounters an undeclared variable, an error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement sets both the default &amp;lt;var&amp;gt;Len&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Dp&amp;lt;/var&amp;gt; options to 0. Therefore, when &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; is in effect, %variables declared as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; must have the &amp;lt;var&amp;gt;Len&amp;lt;/var&amp;gt; specified or an error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Declaring %variables and %variable arrays==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can declare a variable and subsequently assign and reset that variable any number of times during a SOUL request. You can use a variable declaration statement to specify:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Type of variable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Length of the variable and number of decimal places&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Number of elements if the variable is an array&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use of the optional field save feature &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variable arrays===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables also can be declared to be arrays of up to three dimensions. An element of a %variable array is equivalent to a %variable that is not part of an array. It can be used anywhere that a %variable can be used.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Declare statements for %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
To temporarily set or reset the default variable type, length, and number of decimal places for a particular %variable or %variable array in a request, use the &amp;lt;var&amp;gt;Declare&amp;lt;/var&amp;gt; statement.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the following syntax diagrams, the first declaration statement is for numeric %variables and the second declaration statement is for string %variables&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Syntax for numeric %variables:&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;[Declare] &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variable&amp;lt;/span&amp;gt; [Is] {Fixed [Dp &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] | Float} &lt;br /&gt;
 [Array(&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d1&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d2&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d3&amp;lt;/span&amp;gt;]])] &lt;br /&gt;
 &amp;amp;#x5b;[[Initial clause in %variable declaration|Initial]](&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;numeric-expression&amp;lt;/span&amp;gt;)] [Static] &lt;br /&gt;
 [Common]&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Syntax for string %variables:&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;[Declare] &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variable&amp;lt;/span&amp;gt; [Is] String [Len &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;]&lt;br /&gt;
 [Dp [&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt; |*}] &lt;br /&gt;
 [Array(&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d1&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d2&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d3&amp;lt;/span&amp;gt;]])] [No Field Save] &lt;br /&gt;
 &amp;amp;#x5b;[[Initial clause in %variable declaration|Initial]](&#039;&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;EBCDIC-string&amp;lt;/span&amp;gt;&#039; | &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)] [Static] &lt;br /&gt;
 [Common]&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The keyword &amp;lt;var&amp;gt;Declare&amp;lt;/var&amp;gt; is optional. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;var&amp;gt;[[Initial clause in %variable declaration|Initial]]&amp;lt;/var&amp;gt; attribute assigns an initial value to a %variable at compilation time, without using any excess QTBL, STBL, or VTBL space and CPU usage. The &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute is permitted only for numeric expressions or EBCDIC string variables, and not for arrays of any type or DBCS variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute limits assignment to a %variable to the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute and requires the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute to set the %variable&#039;s initial (and only) value.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The various other components of this statement, except for &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt;, are described later in this article; &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; is discussed in [[Subroutines#Common elements|Common elements]].&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If you want to use the &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; attribute on a %variable declaration with the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attributes, the &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; attribute must be the last token in the statement. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%x is float initial (3) static common&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Usage====&lt;br /&gt;
 &lt;br /&gt;
====%Variable Initial value assignment====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value longer than the maximum length results in a compilation warning message:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2493: VARIABLE TOO SMALL FOR INITIAL VALUE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Examples====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following examples use the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In the first example, set %X to the value ABC, using the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute. The value cannot be changed during request evaluation:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%X IS STRING LEN 3 INITIAL(&#039;ABC&#039;) STATIC&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The next example uses a %variable that can be changed during request evaluation:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%Y IS STRING LEN 3 INITIAL(&#039;ABC&#039;)&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The following compiler error message is displayed if you attempt to assign a value to a %variable that has been declared &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt;:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 1 M204.2490: ILLEGAL ASSIGNMENT TO STATIC %VARIABLE&lt;br /&gt;
  %X=5&lt;br /&gt;
  (FILE=CCATEMP, PROCEDURE=0, LINE=3)&lt;br /&gt;
 ==5&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 2 M204.0228: PART OF STATEMENT IGNORED&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.1042: COMPILATION ERRORS&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The next example illustrates using the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute and an expression with the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute.&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X IS STRING LEN 3 INITIAL(&#039;ABC&#039;) STATIC&lt;br /&gt;
%Y IS STRING LEN 3 INITIAL(&#039;DEF&#039;) STATIC&lt;br /&gt;
%ALPHA IS STRING LEN 6 -&lt;br /&gt;
INITIAL($SUBSTR(%X,2,1) WITH $SUBSTR(%Y,2,1)) STATIC&lt;br /&gt;
PRINT %ALPHA&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;***M204.0542:EDIT COMPLETE - GO&lt;br /&gt;
BE&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===%Variable names===&lt;br /&gt;
A variable name can consist of any number of letters, numbers, and some special characters (for example, underscore). &lt;br /&gt;
&lt;br /&gt;
The first character of the name must be a percent sign (&amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; (period) character is not allowed in the name of a variable that is declared as a &amp;lt;var&amp;gt;[[Json class|Json]]&amp;lt;/var&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
A variable name can have no embedded blanks, colons, or any of the following &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; reserved characters:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;=&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;+&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;$&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;(&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;,&amp;lt;/b&amp;gt; (not sign &amp;amp;mdash; see Note below)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;)&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&#039;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;-&amp;lt;/b&amp;gt; (minus sign/hyphen)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&amp;lt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;/&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;,&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; The &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; reserved character is the EBCDIC &amp;quot;not sign,&amp;quot; which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following guidelines apply to certain special characters that are allowed in %variable names:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The @ and # characters also are reserved, unless they are reset by the user through the FLUSH and ERASE parameters.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Dummy string characters (??, ?$, ?&amp;amp;amp;) can be used in variable names, but they perform dummy string substitution, as described in [[Procedures#Using ?$ and ?&amp;amp; dummy strings|Using ?$ and ?&amp;amp; dummy strings]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Relationship to Variables Are statement===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The type, length, and decimal place settings established for a particular %variable by a DECLARE %variable statement are not overridden by a &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. For example, if the statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %NAME STRING LEN 30&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
is followed by the statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;VARIABLES ARE FIXED&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
then &amp;lt;code&amp;gt;%NAME&amp;lt;/code&amp;gt; remains a string of length 30.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==%Variable types==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be declared as one of several distinct types:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; (fixed-point numeric)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; (floating-point numeric)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; (alphanumeric string)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
And these, as of Version 7.5 of Model 204:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Unicode#The SOUL Unicode type|Unicode]]&amp;lt;/var&amp;gt; (Unicode string)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Longstrings|Longstring]]&amp;lt;/var&amp;gt; (string with very large maximum size) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Object variables|Object]]&amp;lt;/var&amp;gt; (reference to an instance of a class) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A [[Method variables|method variable]] (a variable that references a method)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using Fixed or Float for arithmetic statements===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Defining %variables as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; improves the performance of arithmetic statements. If the result of an arithmetic operation is being assigned to a %variable, the result is not converted before assignment if the arithmetic operands are of the same type.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Arithmetic operations are performed most efficiently if all %variables are defined with matching options: either as &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; or as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, and with no decimal places or the same number of decimal places. To operate &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; as efficiently as possible, avoid mixed-type arithmetic. Use &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables only when string manipulations are required.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic operation where both operands are &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; requires rules to determine the scale (number of decimal places) of the result. See [[#Fixed precision arithmetic|Fixed precision arithmetic]] for detailed information on the way &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; handles &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; arithmetic operations.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic result types===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
[[#Arithmetic result types|Arithmetic result types]] shows the types and the results for various combinations of operands in an arithmetic statement. The result described in the table refers to the result of an arithmetic operation, which might be an intermediate result. If the final result is being assigned to a %variable of a different type, it is converted to match.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;%Variable types for arithmetic results&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operand 1&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operand 2&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Arithmetic result type&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==%Variable lengths==&lt;br /&gt;
 &lt;br /&gt;
===Fixed %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
%Variables declared as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; can have a decimal place specification associated with them. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Declare %total Fixed dp 2&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
represents a dollar total. A &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; %variable can contain as many as 15 significant digits, including decimal places. There can be as many as 9 decimal places.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Float %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables declared as &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; are stored as double-precision floating-point numbers. Precision is guaranteed to 15 decimal digits; the exponent must be between 75 and -74. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===String %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables declared as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; can have a maximum length as well as an optional decimal place specification associated with them. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %NAME STRING LEN 20 DP 2&lt;br /&gt;
VARIABLES ARE STRING LEN 7&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The first statement (above) declares the %NAME variable as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;, with a maximum length of 20 and two decimal places. The second statement sets the defaults for %variables not explicitly declared: &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; with a maximum length of 7 and no decimal places.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Additionally, the decimal place for &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables can be variable by specifying DP *. This causes all decimal digits to be placed in the string. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %AMOUNT IS STRING LEN 10 DP *&lt;br /&gt;
   %AMOUNT = 1.2&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
   %AMOUNT = 1.23&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
   %AMOUNT = 1.234&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Yields: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;1.2&lt;br /&gt;
1.23&lt;br /&gt;
1.234&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The maximum length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable is 255 characters. Decimal places, and the decimal point itself, are included in the specified length. Alternatively, the default values for length and decimal places can be used. An attempt to store a value longer than the declared or default length results in truncation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The current length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable is determined by the value put into the &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable. You can use the &amp;lt;var&amp;gt;[[$Len#$Len|$Len]]&amp;lt;/var&amp;gt; function to find the current length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement is used, the values for length and decimal places must be specified with each &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable declaration. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==%Variable arrays==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can define %variables as arrays of one, two, or three dimensions with the &amp;lt;var&amp;gt;Declare &amp;lt;i&amp;gt;%variable&amp;lt;/i&amp;gt;&amp;lt;/var&amp;gt; statement. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %CODES STRING LEN 5 ARRAY(100)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a one-dimensional array of up to 100 message codes, each five characters in length.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %TRANSACTION FIXED DP 2 ARRAY(12,10000)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a two-dimensional array of dollar transactions for a store. The array contains up to 10,000 transactions for each of 12 departments.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %READINGS FLOAT ARRAY(3,10,80)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a three-dimensional array consisting of up to 80 atmospheric readings of three distinct types from 10 monitoring stations.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Array elements must be of one type===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
All elements of an array must have the same type (&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;, or &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;) and element length.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===%Variable array references===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An array can be referred to only after it has been declared in an array can have as many as three declared dimensions. A subscript value must be supplied for each dimension. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If a variable is declared as an array, it must always be referenced with subscripts.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Each of the subscript values that refers to a dimension can be a number or an expression. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%CODE(2)&lt;br /&gt;
%READING(3,200-%A/%B,%N)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
As shown in the examples, the expression can contain references to other %variables. The subscript value is converted to an integer. Any fraction is truncated before the subscript value is used as the array subscript. The subscript value must fall within the declared range of dimensions.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===No Field Save option===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable array is declared, you can specify:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;No Field Save&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If you do not intend to use any of the &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; array elements as field name variables, you should select the &amp;lt;var&amp;gt;No Field Save&amp;lt;/var&amp;gt; option, to save space in the user work areas described in [[Large request considerations#STBL (character string table)|STBL (character string table)]]. (Field name variables are discussed in detail on [[#Field name variables|Field name variables]].)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An element of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; array can be used as a field name variable even if &amp;lt;var&amp;gt;No Field Save&amp;lt;/var&amp;gt; is specified. However, when the value of the element is referred to as a field name, extra processing and additional disk I/O are required for each reference after the first.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Assigning values to %variables==&lt;br /&gt;
 &lt;br /&gt;
===Assignment statements===&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The format of the statement used to calculate and assign the value of %variables is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variablename&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The name of the %variable to be set appears to the left of the equal sign and the expression to whose value the %variable is to be set is at the right. (See also [[#Expressions|Expressions]].)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For Large Object data, a compiler error is issued when the right side of the equal sign is expected to contain a BUFFER expression and it does not.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2691: BUFFER ASSIGNMENT MUST REFERENCE LARGE OBJECT FIELD&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and/or&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2704: BUFFER REFERENCE REQUIRES LOB FIELD&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
These statements are valid assignments:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%AGENT = AGENT&lt;br /&gt;
%NAME = &#039;DALE STERN&#039;&lt;br /&gt;
%RESULT = (%INCREASE + TOTAL PREMIUM) * .01&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note that &amp;lt;code&amp;gt;%AGENT&amp;lt;/code&amp;gt; is legal as a variable name even if &amp;lt;code&amp;gt;AGENT&amp;lt;/code&amp;gt; is a field name in the file. The variable and the field are not related to each other.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Relationship between %variable assignment and declaration===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Normally, an assignment statement precedes a %variable reference in another statement. If a %variable is going to be declared with the &amp;lt;var&amp;gt;Declare &amp;lt;i&amp;gt;%variable&amp;lt;/i&amp;gt;&amp;lt;/var&amp;gt; statement, the declaration must precede the first use of the %variable. If an assignment statement does not precede the %variable reference, or the variable has not been declared, then default values (null values for &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; types, 0 for &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;) are assigned to the %variable.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Truncation vs. rounding on assignment===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In an assignment statement, it is possible for the length of the assigned value to exceed the maximum length for that %variable (as determined in the variable declaration statement, the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement, or the value of the VLEN or VDP parameter). The way &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; treats this situation depends on the %variable type.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; %variables, the assigned value is rounded to 15 significant digits. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; %variables, if the number of places to the left of the decimal point in the assigned value, plus the number of decimal places declared (not assigned) exceeds 15, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; returns an error message and assigns a value of zero. Otherwise, if the number of decimal places assigned exceeds the number declared, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; truncates the assigned value to the number of decimal places declared. For example, the following request:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X IS FIXED DP 0&lt;br /&gt;
%Y IS FLOAT&lt;br /&gt;
%Z IS FLOAT&lt;br /&gt;
%X = 1.9&lt;br /&gt;
%Y = 5&lt;br /&gt;
%Z = %X * %Y&lt;br /&gt;
PRINT &#039;%X = &#039; WITH %X&lt;br /&gt;
PRINT &#039;%Y = &#039; WITH %Y&lt;br /&gt;
PRINT &#039;%X * %Y = &#039; WITH %Z&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
results in this output:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%X = 1&lt;br /&gt;
%Y = 5&lt;br /&gt;
%X * %Y = 5&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The value of %X is truncated from 1.9 to 1 upon assignment for both display and computation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables, if the number of characters in the assigned value exceeds the maximum declared length (or, if not declared, the default length set by the VLEN parameter), the assigned value is truncated to the maximum length allowed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Changing %variable values===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can change the value of a %variable at any point in a request by using an assignment statement. The variable is stored for the duration of the request that assigns it, including any continuations, and is then deleted. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
At the beginning of a request, all %variables are set equal to a null string, or to zero, depending on their types. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
During a request, a %variable can be set equal to another %variable, a quoted string, a number, a field value, a noted value, a function, a count of records or field occurrences, an occurrence number, a null value, or the result of a computation.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===&amp;lt;b id=&amp;quot;initial&amp;quot;&amp;gt;&amp;lt;/b&amp;gt;Understanding Initial processing===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Code written using an &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; assignment for both %variables results in the assigned value of &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; as the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assigned for &amp;lt;code&amp;gt;%Y&amp;lt;/code&amp;gt; as both assignments are resolved at compilation. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN &lt;br /&gt;
%X IS STRING LEN 1 INITIAL(1)&lt;br /&gt;
 * %X assigned the INITIAL value of 1, at compilation&lt;br /&gt;
%Y IS FIXED INITIAL(%X)&lt;br /&gt;
 * %Y assigned the INITIAL value of %X, at compilation&lt;br /&gt;
PRINT &#039;Y = &#039; %Y&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
Y = 1&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assignment in the format &amp;lt;code&amp;gt;%Y IS FIXED INITIAL (%X)&amp;lt;/code&amp;gt;, will not resolve to the value of &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt;, if &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; was assigned in the format &amp;lt;code&amp;gt;%X=1&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;%X=1&amp;lt;/code&amp;gt; format variable assignments are resolved at evaluation, subsequent to compilation. &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assignments are resolved at compilation. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following code reflects this processing:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X IS STRING LEN 1&lt;br /&gt;
%X = 1&lt;br /&gt;
 * %X assigned the value of 1 at evaluation &lt;br /&gt;
%Y IS FIXED INITIAL(%X)&lt;br /&gt;
 * %Y assigned the INITIAL value at compilation &lt;br /&gt;
PRINT &#039;Y = &#039; %Y&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
Y = 0&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; value is assigned at evaluation. The &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value is assigned at compilation, prior to the evaluation of &amp;lt;code&amp;gt;%X=1,&amp;lt;/code&amp;gt;. The result is that &amp;lt;code&amp;gt;%Y&amp;lt;/code&amp;gt; is assigned the default value, zero (0), for its type of &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expressions==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Expressions are evaluated by &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; and used to assign values to %variables and function arguments, or included as operands in computation or conditional statements.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An expression has this format:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;{&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/span&amp;gt; | (&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)} &lt;br /&gt;
 [&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operator&amp;lt;/span&amp;gt; {&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/span&amp;gt; | (&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)}]...&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/var&amp;gt; is one of the following:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;%%variable (field name variable)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;%variable or element of %variable array&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;COUNT IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Field name&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Function &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Number&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;OCCURRENCE IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted string&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;VALUE IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;operator&amp;lt;/var&amp;gt; can be arithmetic, Boolean, comparison, or concatenation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Operator order of precedence===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table lists the operators used within expressions in order of precedence. Parentheses can be used to override the order.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Operator order of precedence in expressions&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Order of precedence&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; First&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IS PRESENT, IS NOT PRESENT&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Second&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;- (unary minus)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Third&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;*,/&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Fourth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;+,-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Fifth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;WITH&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Sixth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;EQ, =, LE, &amp;lt;=, GT, &amp;gt;, GE, &amp;gt;=, NE,  ,=, LT,   IS [NOT] LIKE&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Seventh&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;NOT&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Eighth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;AND&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Ninth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;OR&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Tenth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;AND (implied by a new line; occurs only in an &amp;lt;var&amp;gt;If&amp;lt;/var&amp;gt; statement) &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;blockquote class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The first character (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;) of the inequality test above is the EBCDIC &amp;quot;not sign&amp;quot;, which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For a description of the &amp;lt;code&amp;gt;IS [NOT] LIKE&amp;lt;/code&amp;gt; clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]]. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Incomplete expressions===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Incomplete expressions, such as the following: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;IF %X = 10 OR %Y &amp;gt; 40 AND %A = %B WITH&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
produce this message: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.0052 ILLEGAL TERM&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Compilation does not succeed and the procedure does not run. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using expressions for value retrieval===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can use expressions for value retrieval in the following SOUL statements:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Update statements (STORE RECORD, ADD, CHANGE, DELETE, INSERT)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FILE RECORDS&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND - POINT$ condition&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND - SFL$ and SFGE$ conditions&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH RECORD IN ORDER BY&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH RECORD WHERE&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND ALL VALUES&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH VALUE&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR RECORD NUMBER&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Expression types supported in SOUL statements====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table provides examples of the types of expressions that you can use to supply retrieval values for statements. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Expression types supported in statements&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expression type&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Example&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Function call&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD ORDER.DATE EQ VALUE($DATE(1,&amp;amp;apos;&#039;))&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;String concatenation&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD BIRTH.DATE EQ VALUE(%YYYY WITH %MM WITH %DD)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Arithmetic operation&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD SALES.VALUE EQ VALUE(%ITEM.VALUE * %ITEM.SALES )&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;SOUL construct&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD NUM.ORDERS EQ VALUE(COUNT IN FD.ORDERS)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Boolean expression&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD ORDER.STATUS EQ VALUE(%STATUS IS LIKE &#039;A*&#039;)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following example shows these different types of expressions used as values.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;B&lt;br /&gt;
%MM IS STRING LEN 2&lt;br /&gt;
%DD IS STRING LEN 2&lt;br /&gt;
%BASE.PREMIUM IS FLOAT&lt;br /&gt;
%PCT.INCREASE IS FLOAT&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* function call expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD1&#039;&lt;br /&gt;
FD1:&lt;br /&gt;
IN CLIENTS FPC INCIDENT DATE EQ -&lt;br /&gt;
   VALUE($DATECHG(&#039;YYYYMMDD&#039;,$DATE(1,&amp;amp;apos;&amp;amp;apos;),-3169))&lt;br /&gt;
        END FIND&lt;br /&gt;
FR FD1&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* string concatenation expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD2&#039;&lt;br /&gt;
%MM = &#039;09&#039;&lt;br /&gt;
%DD = &#039;17&#039;&lt;br /&gt;
FD2:&lt;br /&gt;
IN CLIENTS FPC ANNIV DATE EQ VALUE(%MM WITH %DD)&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD2&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* arithmetic operation expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD3&#039;&lt;br /&gt;
%BASE.PREMIUM = 1280&lt;br /&gt;
%PCT.INCREASE = 1.25&lt;br /&gt;
FD3:&lt;br /&gt;
IN CLIENTS FPC TOTAL PREMIUM EQ VALUE(%BASE.PREMIUM * %PCT.INCREASE)&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD3&lt;br /&gt;
   PAI&lt;br /&gt;
FEO1:&lt;br /&gt;
   FEO VIN&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* UL syntax expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
  PRINT &#039;FD4&#039;&lt;br /&gt;
FD4:&lt;br /&gt;
  IN VEHICLES FPC VIN EQ VALUE(VALUE IN FEO1)&lt;br /&gt;
        END FIND&lt;br /&gt;
  FR FD4&lt;br /&gt;
     PAI&lt;br /&gt;
     PRINT&lt;br /&gt;
  END FOR&lt;br /&gt;
   END FOR&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* boolean expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD5&#039;&lt;br /&gt;
FD5:&lt;br /&gt;
IN CLIENTS FPC INCIDENT EQ VALUE(&#039;T&#039; WITH (%DD IS LIKE &#039;1*&#039;))&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD5&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Operators==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This section describes the use of four types of operators:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Arithmetic&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Comparison&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Boolean&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;With&amp;lt;/var&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
See the previous section for a discussion of expressions, and the next section for a discussion of operands. See [[#Fixed precision arithmetic|Fixed precision arithmetic]] for a more detailed discussion.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table lists the arithmetic operators:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;+&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Addition&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;-&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Subtraction, unary minus&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;*&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Multiplication&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;/&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Division &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Order of operations====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The arithmetic operators are used to compute the value of a %variable or they can be included in an expression. When an expression contains several arithmetic operations, the operations are performed in the order shown in [[#Operator order of precedence|Operator order of precedence]]. Operators of equal precedence are evaluated in order of appearance, from left to right. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%result = 8*7 + 4 &amp;lt;/p&amp;gt;&lt;br /&gt;
sets &amp;lt;code&amp;gt;%result&amp;lt;/code&amp;gt; to 60.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Parentheses change the order of operations; expressions within parentheses are compiled first. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;4-5*2*3 = -26&lt;br /&gt;
(4-5)*(2*3) = -6&lt;br /&gt;
(4-(5*2))*3 = -18&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Arithmetic overflow====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic overflow might occur during evaluation of a computation statement. If such an overflow occurs, the request is cancelled and an appropriate error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Comparison operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following comparison operators are used to compare two objects, two strings, two numbers, or a string and a number:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;EQ, = &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Equal&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;NE, ^= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Not equal&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;GT, &amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Greater than&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;LT, &amp;lt; &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Less than&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;GE, &amp;gt;= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Greater than or equal to&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;LE, &amp;lt;= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Less than or equal to&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;IS [NOT] LIKE&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Pattern matching equivalents&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;IS [NOT] PRESENT&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Field existence&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
When a comparison operator is included in an expression, a value of 1 results if the stated relation between operands is true; if false, a value of 0, provided that &amp;lt;i&amp;gt;one&amp;lt;/i&amp;gt; of the following conditions apply (using the expression &amp;lt;code&amp;gt;%I = (%A&amp;lt;=%B)&amp;lt;/code&amp;gt; to illustrate): &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Either %A or %B (or both) is declared as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Either %A or %B (or both) is signed in the expression; for example,&lt;br /&gt;
&amp;lt;code&amp;gt;%I = (+%A &amp;lt;=%B)&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;VTYPE = FLOAT or FIXED, and VLEN is greater than zero.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The resulting value returned from the expression might be invalid if &amp;lt;i&amp;gt;all&amp;lt;/i&amp;gt; the following conditions apply:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Neither %A nor %B is declared.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The expression does not sign the variable.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The system default for VTYPE is &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; and VLEN is greater than zero.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;See the discussion about the conditional statement in [[Flow of control in User Language#Comparison operators|Comparison operators]] for a description of these operators in conditional statements. &amp;lt;/li&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;li&amp;gt;The first character (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;) of the inequality test above is the EBCDIC &amp;quot;not sign&amp;quot;, which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For a description of the &amp;lt;code&amp;gt;IS [NOT] LIKE&amp;lt;/code&amp;gt; clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Boolean operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Use the Boolean operators listed in the following table to modify or link together comparison expressions. (See the discussion about [[Flow of control in User Language#Boolean operators|Boolean operators and conditional statements]] for information on comparisons.)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Boolean operators&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Not&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;The value of the comparison is reversed.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;And&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Both comparisons must be true.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Or&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Either comparison must be true. &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Boolean operators are not restricted to comparisons. They also can be used in the middle of expressions (for example, &amp;lt;code&amp;gt;1 AND 2&amp;lt;/code&amp;gt;).&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===With operator===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;var&amp;gt;With&amp;lt;/var&amp;gt; can be used in an expression to concatenate two strings. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%A = &#039;$&#039; WITH TOTAL PREMIUM&lt;br /&gt;
PRINT %A TO COLUMN 10&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
results in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;$550&lt;br /&gt;
$1092&lt;br /&gt;
$605&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Operands==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This section describes the use of four types of operands: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;%variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted strings&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Numbers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fields&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
See also&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Expressions|Expressions]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Operators|Operators]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Fixed precision arithmetic|Fixed precision arithmetic]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variables as operands===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
After you define a %variable, you can use it to change other %variables. For example: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = %NUM&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
sets &amp;lt;code&amp;gt;%COUNT&amp;lt;/code&amp;gt;, and:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = %COUNT + 1&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
replaces the value of %COUNT&amp;lt;code&amp;gt;%COUNT&amp;lt;/code&amp;gt; by its former value plus 1. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Quoted strings===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Examples of %variables set to quoted strings are provided here:  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%NAME = &#039;TETLEY&#039;&lt;br /&gt;
%AGE = &#039;53&#039;&lt;br /&gt;
%TITLE = &#039;QUARTERLY REPORT&#039;&lt;br /&gt;
%SPOUSE = &#039;&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the preceding example, &amp;lt;code&amp;gt;%SPOUSE&amp;lt;/code&amp;gt; is a quoted string that has a length of 0. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Additional information about the use of quotation marks is provided in [[Request composition rules#Quotation marks|Quotation marks]].&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Numbers===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A number used as the value of a %variable or as a term in an expression can be a string of digits containing an optional sign and an embedded decimal point.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;3     +0.002&lt;br /&gt;
45.7  -37&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The magnitude of the number is limited by the magnitude of the largest number that can be represented in a floating point number. Therefore the number&#039;s exponent (if the number is expressed in exponent notation) must be between 75 and -74.  &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Fields===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Field values, referred to by field name, can be used in an assignment statement, but only inside a FOR EACH RECORD loop. To evaluate an expression, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; uses the value of the field for the current record each time through the loop. For example: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;FOR EACH RECORD IN FIND.RECS&lt;br /&gt;
   %PROFIT = %INCREASE - TOTAL PREMIUM&lt;br /&gt;
   PRINT %PROFIT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
calculates profit from the data in each record and prints it. &amp;lt;code&amp;gt;%PROFIT&amp;lt;/code&amp;gt; changes for each record.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In expressions, the values of most types of fields are treated as character strings. The values of fields defined with the FLOAT attribute are treated as numbers. If a field is missing from a record being processed, the value used is a null string. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Fixed precision arithmetic==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic operation where both operands are &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; requires rules to determine the scale (maximum numbers of digits and decimal places) of the result.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Scale of intermediate results===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; determines the scale of intermediate results (the number of decimal places) using the following rules.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Addition and subtraction====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires either addition or subtraction, the scale of the temporary variable containing the result equals the larger of the scales of the two operands. For example, the scale for the result of the following expression is 3:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12.345 + 3.6&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the result exceeds 15 digits, decimal places are dropped from the right to produce the largest possible scale that fits in 15 digits. If a 15 digit number cannot be produced even by dropping all decimal places, an overflow condition is indicated.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Multiplication====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires multiplication, the scale of the temporary variable containing the result is equal to the sum of the scales of the two operands. For example, the scale for the result of the following expression is 5 (3+2):&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12.345 * 3.64&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the sum of the scales of the operands exceeds 9 or if the result is larger than 15 digits, decimal places are dropped from the right to produce the largest possible scale that fits in 15 digits. As with addition and subtraction, if the result has more than 15 digits with all decimal places discarded, an overflow condition is indicated.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Division====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires division, the scale of the temporary variable containing the result is equal to the larger of:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;9&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;the largest possible scale that fits in 15 digits&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example, the scale for the result of this expression is 9 (the calculated result is 3.529411764):&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12 / 3.4&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Causes of overflow conditions===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following situations are treated as overflow conditions:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;When the integer portion of any intermediate or final result is larger than 15 digits.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For addition and multiplication, when the scale of the final result variable is so large that the integer portion of the result cannot fit into the maximum allotted size. For example:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %A IS FIXED DP 0&lt;br /&gt;
   %B IS FIXED DP 0&lt;br /&gt;
   %C IS FIXED DP 9&lt;br /&gt;
   %A = 999999&lt;br /&gt;
   %B = 1&lt;br /&gt;
   %C = %A + %B&lt;br /&gt;
PRINT &#039;C = &#039; %C&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0552: VARIABLE TOO SMALL FOR RESULT&lt;br /&gt;
C = 0.000000000&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Because the scale of the variable which contains the final result (%C) is 9, the integer portion of the result is limited to no more than 6 digits. Because the integer portion of the result requires 7 digits, an overflow condition is triggered.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This example illustrates that &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; takes into consideration the scale of the final result variable. The example below is identical to the one above except that the scale of %C is set to 8. The request executes successfully because this frees the required 7 digits for the integer portion of the result:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %A IS FIXED DP 0&lt;br /&gt;
   %B IS FIXED DP 0&lt;br /&gt;
   %C IS FIXED DP 8&lt;br /&gt;
   %A = 999999&lt;br /&gt;
   %B = 1&lt;br /&gt;
   %C = %A + %B&lt;br /&gt;
PRINT &#039;C = &#039; %C&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
C = 1000000.00000000&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===How Model 204 responds to overflow conditions===&lt;br /&gt;
 &lt;br /&gt;
====Overflowing to zero====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; detects an overflow condition, the intermediate result is set to 1015. Since this is a 16-digit number, it is illegal in SOUL and tends to cause a cascade of overflow conditions in a complex expression, which can generate the following error message:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.0552: VARIABLE TOO SMALL FOR RESULT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The final result of the expression is usually 0, which lets you see that an overflow error might have occurred. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Overflowing to very large, obviously incorrect number====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An exception to the rule of a 0 final result is the case where an overflow occurs in an intermediate step and the next step (whether intermediate or final) involves subtracting a value whose scale is 0 so that the result is less than 1015. In this case, you get a large, incorrect, result. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %X IS FIXED DP 0&lt;br /&gt;
   %Y IS FIXED DP 0&lt;br /&gt;
   %Z IS FIXED DP 0&lt;br /&gt;
   %X = 10E13&lt;br /&gt;
   %Y = 350000&lt;br /&gt;
   %Z = 10&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* (%X * %Y) WILL OVERFLOW AND BECOME 10E15&lt;br /&gt;
   %X = (%X * %Y) - %Z&lt;br /&gt;
PRINT &#039;X =&#039; %X&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 1  M204.0563: ARITHMETIC OVERFLOW&lt;br /&gt;
X = 999999999999990&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Value In, Count In, and Occurrence In phrases==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can set a %variable value based on the following elements of a SOUL request:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Value In&amp;lt;/var&amp;gt; phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to a noted value, as illustrated below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%DRIVER = VALUE IN NOTE.DRIVER&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This phrase also can be included in an expression or used to include the current value in a &amp;lt;var&amp;gt;For Each Occurrence&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;For Each Value&amp;lt;/var&amp;gt; loop.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;COUNT IN phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to the number of records counted, as in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = COUNT IN NO.OF.VINS&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This phrase also can be included in an expression. &amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;OCCURRENCE IN phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to the subscript value of the current occurrence of a field in a record, as in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%OCCUR = OCCURRENCE IN INCIDENT.TYPE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
where INCIDENT.TYPE is the statement label of a &amp;lt;var&amp;gt;For Each Occurrence&amp;lt;/var&amp;gt; statement. This phrase also can be included in an arithmetic expression.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Conversions and significant digits==&lt;br /&gt;
 &lt;br /&gt;
===Numeric terms===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following expression terms are considered numeric:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Literal (unquoted) numbers: -3, .0079&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Count In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Occurrence In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Some functions (see [[List of mathematical $functions]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Results of numeric expressions&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; %variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FLOAT fields &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Character terms===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following expression terms are considered character:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted strings: &#039;SMITH&#039;, &#039;.0079&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Non-FLOAT fields: NAME, ADDRESS&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Value In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Some functions (see [[M204wiki main page#$Functions|$Functions]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Conversion===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the expression &amp;lt;code&amp;gt;AGE + 10&amp;lt;/code&amp;gt;, the value of the field AGE (character) is added to a literal number (numeric). &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; converts the value of AGE to a number. If the value is a proper number (for example, 5, -3.943, +.0003), the conversion is obvious; if not, the value is not a proper number (for example, FIVE, &amp;quot;, ABCD) or a number with too many digits, it is converted to a zero.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the expression &amp;lt;code&amp;gt;&#039;NUMBER&#039; WITH -3.8&amp;lt;/code&amp;gt;, a quoted string is to be concatenated with a number. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; first converts the number to a character string. In such a conversion, all decimal places are lost; the number is truncated to an integer and the result is NUMBER-3.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Significant digits in computations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL can accept as input to computations the largest floating point number that can be expressed in exponent notation and can produce results of that magnitude. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
However, all results contain at most 15 significant decimal digits, with zeros in the low-order positions. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; preserves 15 digits in all intermediate results, rounding each result to 15 digits before going on to the next intermediate calculation. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the final result is assigned to a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable, that result is truncated on the right to the maximum length specified for the %variable. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Sample request using %variables==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following request illustrates an assignment statement. The request computes the total settlement amount for each claim type within a file. Output consists of a 2-column table, giving a total amount for each type as well as a grand total settlement amount. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
            VARIABLES ARE STRING DP 2&lt;br /&gt;
            SET HEADER 2 &#039;TOTAL&#039; TO COLUMN 34&lt;br /&gt;
            SET HEADER 3 &#039;CLAIM TYPE&#039; -&lt;br /&gt;
               WITH &#039;SETTLEMENT AMOUNT&#039; TO COLUMN 40&lt;br /&gt;
            SET HEADER 4&lt;br /&gt;
            NEW PAGE&lt;br /&gt;
EACH.TYPE:  FOR EACH VALUE OF CLAIM TYPE&lt;br /&gt;
TYPE.MATCH:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                  CLAIM TYPE = VALUE IN EACH.TYPE&lt;br /&gt;
               END FIND&lt;br /&gt;
               FOR EACH RECORD IN TYPE.MATCH&lt;br /&gt;
                  %TOT = %TOT + SETTLEMENT AMOUNT&lt;br /&gt;
               END FOR&lt;br /&gt;
               PRINT VALUE IN EACH.TYPE AT COLUMN 6 -&lt;br /&gt;
                  WITH %TOT TO COLUMN 36&lt;br /&gt;
               %GRANDTOT = %GRANDTOT + %TOT&lt;br /&gt;
               %TOT = 0&lt;br /&gt;
            END FOR&lt;br /&gt;
            SKIP 1 LINE&lt;br /&gt;
            %GRANDTOT = &#039;$&#039; WITH %GRANDTOT&lt;br /&gt;
            PRINT &#039;GRAND TOTAL:&#039; WITH %GRANDTOT TO COLUMN 36&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note that the user resets the value of &amp;lt;code&amp;gt;%TOT&amp;lt;/code&amp;gt; to 0 after each pass through the value loop. Because %variables retain their values until explicitly reset, the user is responsible for clearing %variables that are to be reused. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; does not perform this type of housekeeping routine automatically.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The output resulting from the preceding request is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;                             TOTAL&lt;br /&gt;
CLAIM TYPE              SETTLEMENT AMOUNT&lt;br /&gt;
 &lt;br /&gt;
     O                      52905.00&lt;br /&gt;
     C                      53310.00&lt;br /&gt;
     L                      51773.00&lt;br /&gt;
 &lt;br /&gt;
GRAND TOTAL:              $157988.00&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Using %variables in place of the Note statement==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In most cases the &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement can be replaced with an assignment statement to achieve the same results. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In this example, &amp;lt;code&amp;gt;POLICY NO&amp;lt;/code&amp;gt; is assigned to a variable rather than a &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
POL.HOLDERS: FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                RECTYPE = POLICYHOLDER&lt;br /&gt;
             END FIND&lt;br /&gt;
             FOR EACH RECORD IN POL.HOLDERS&lt;br /&gt;
                %POLICY.NO = POLICY NO&lt;br /&gt;
EACH.POL.NO:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                   POLICY NO = %POLICY.NO&lt;br /&gt;
                   RECTYPE = DRIVER&lt;br /&gt;
                END FIND&lt;br /&gt;
                FOR EACH RECORD IN EACH.POL.NO&lt;br /&gt;
                   PRINT %POLICY.NO AND FULLNAME&lt;br /&gt;
                END FOR&lt;br /&gt;
             END FOR&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Caution:&amp;lt;/b&amp;gt; Some caution is required when substituting %variables for &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement values. The &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement retains up to 255 characters, while an undeclared %variable retains only the default length set by the &amp;lt;var&amp;gt;VLEN&amp;lt;/var&amp;gt; parameter. If a %variable is used for a long field value, the length parameter for the %variable must be reset to avoid truncation.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Impact on STBL space===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Another difference between %variables and &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement values is the use of space in the system work area STBL. For more information on STBL, refer to [[Large request considerations#STBL (character string table)|STBL (character string table)]].&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Field name variables==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Field name variables permit indirect reference to field names, thereby permitting many procedures and requests to be generalized without using dummy strings (refer to [[Procedures#Dummy strings in procedures|Dummy strings in procedures]] for a discussion). The actual field names used in a particular procedure or request are specified when the request is executed. Field name variables are extensions of the %variables described in the preceding section. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A field name %variable is indicated in this format:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%name&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%DISCOUNT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
During the evaluation phase of a request, a string value can be assigned to a %variable:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%DISCOUNT = &#039;DISCOUNT&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and that %variable can then be used in SOUL statements where field names normally appear, as in this example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;ADD.REC: STORE RECORD&lt;br /&gt;
            %%DISCOUNT = .055&lt;br /&gt;
         END STORE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A field name variable and a variable with identical names are actually the same variable. When the variable is used in %variable context (for example, on the left hand side of an assignment statement), it takes the usual %name form. If the same variable is used in a field name context (for example, to the left of an equal sign (=) in a FIND condition), it takes the %%name form. In the latter case, the value of the variable (when the &amp;lt;var&amp;gt;Find&amp;lt;/var&amp;gt; statement is evaluated) is used as the field name. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
START.REQUEST: %A = $READ(&#039;ENTER FIELD NAME&#039;)&lt;br /&gt;
IF.QUIT:      IF %A EQ &#039;QUIT&#039; THEN&lt;br /&gt;
                 JUMP TO STOP.REQUEST&lt;br /&gt;
              END IF&lt;br /&gt;
              %B = $READ(&#039;ENTER VALUE&#039;)&lt;br /&gt;
MATCH.SET:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                 %%A = %B&lt;br /&gt;
              END FIND&lt;br /&gt;
              FOR EACH RECORD IN MATCH.SET&lt;br /&gt;
PRINT.INFO:      PRINT &#039;RECNO &#039; WITH RECNO -&lt;br /&gt;
                    WITH %A AT COLUMN 15 AND %%A&lt;br /&gt;
              END FOR&lt;br /&gt;
              JUMP TO START.REQUEST&lt;br /&gt;
STOP.REQUEST: PRINT &#039;END OF REQUEST&#039;&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the file consists of these two records:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;RECNO = 1       RECNO = 2&lt;br /&gt;
AGE = 23        AGE = 1&lt;br /&gt;
WEIGHT = 146    WEIGHT = 23&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and the user replies to the $READ prompts with:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;AGE&lt;br /&gt;
23&lt;br /&gt;
WEIGHT&lt;br /&gt;
23&lt;br /&gt;
QUIT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The output from the request is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;RECNO 1         AGE 23&lt;br /&gt;
RECNO 2         WEIGHT 23&lt;br /&gt;
END OF REQUEST&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The START.REQUEST and IF.QUIT statements use %A as a variable. When %A is used as a field name variable in the FIND condition of the MATCH.SET statement, it appears as %%A. In the PRINT.INFO statement, both %A and %%A are used. First the value of %A (the string value that represents the field name) is printed. Then %%A is used as a field name, printing the value of that field within the record.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Assigning values to field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You need to be aware of the difference between the following statements:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;FIELD.VAR: %a = EMPLOYEE NUM&lt;br /&gt;
 &lt;br /&gt;
STRING.VAR: %a = &#039;EMPLOYEE NUM&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The FIELD.VAR statement assigns the value of the field named EMPLOYEE NUM from the current record to %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;. The FIELD.VAR statement must appear within a &amp;lt;var&amp;gt;For Each Record&amp;lt;/var&amp;gt; loop. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In contrast, the STRING.VAR statement assigns the character string &amp;lt;code&amp;gt;EMPLOYEE NUM&amp;lt;/code&amp;gt; as the value of %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;. If %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is to be used subsequently as a field name variable, it must contain a valid field name for the file(s) being examined by the request. &amp;lt;/p&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Subscripted field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can use subscripts with field name variables, as discussed in [[Processing multiply occurring fields and field groups#Subscripts|Subscripts]]. This is often useful in specifying indirect references to particular occurrences of multiply occurring fields. Any field name variable can be followed by a parenthesized expression. The value of this expression is used as a subscript that specifies the desired occurrence of the named field. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example, the field name variable reference:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%DISCOUNT(5)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
refers to the fifth value of the field represented by the field name variable, %%DISCOUNT.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The evaluation of subscript expressions is subject to the rules of assignment to an integer discussed earlier in this section.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
It is also possible for the field name variable being subscripted to be an element of an array. The format of such a reference is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%variable (a1 [, a2 [, a3] ]) (n)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
where a1, a2, and a3 are the subscripts of the array, and n is the occurrence subscript. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%ITEM(3,5) (4)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
indicates the fourth occurrence of the field. The actual value of the field name variable is saved as the element of the array, %ITEM, with subscripts (3,5). &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Resolution of field types and levels===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Some statements operate only on fields of a particular type. Such requirements usually are enforced when a request is compiled. The use of field name variables defers error checking until the request is evaluated and the values of the variables are known. The value of a field name variable is checked for the same errors as field names known at compilation time (a reference to an undefined field, an attempt to print an &amp;lt;var&amp;gt;INVISIBLE&amp;lt;/var&amp;gt; field, a length error on a preallocated field, or a security access violation). If an error is detected the request evaluation is cancelled.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Possible file inconsistency====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Cancellation of a request during a sequence of statement updates could leave a file in a logically inconsistent state. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This occurs if a change is made before an incorrect reference to a field name variable, and also before a dependent change is made. A request that stores records using field name variables for some fields, or a request that operates on fields with security levels, could leave a file in an inconsistent state if an error occurs for one or more of the fields. The result might be a record without some or all of its fields. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The field type and security level of a variable can be checked before updating by using the &amp;lt;var&amp;gt;[[$Dscr]]&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;[[$FlsAcc]]&amp;lt;/var&amp;gt;, and &amp;lt;var&amp;gt;[[$FlsChk]]&amp;lt;/var&amp;gt; functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- end of toc limit div --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:SOUL]]&lt;/div&gt;</summary>
		<author><name>SSmirnova</name></author>
	</entry>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=Using_variables_and_values_in_computation&amp;diff=104472</id>
		<title>Using variables and values in computation</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=Using_variables_and_values_in_computation&amp;diff=104472"/>
		<updated>2017-10-19T17:37:10Z</updated>

		<summary type="html">&lt;p&gt;SSmirnova: /* Understanding Initial processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;toclimit-3&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL lets you use variables to represent values. You can use a SOUL variable, called percent variable (%variable), because variable names must start with a percent sign, any place in a SOUL statement that requires a value.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can declare %variables for a single value or as an array. For the purposes of discussing SOUL, the term %variable is used to mean both a %variable and an element of a %variable array.&lt;br /&gt;
The features discussed in this article enable you to generate additional information based on data in the file.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Special types of variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In addition to the basic %variables (and variable arrays) discussed in this article, SOUL provides the following types of variables:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Type of variable &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;See...&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Field name &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; [[#Field name variables|Field name variables]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Screen variables &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Full-screen feature#Full-screen variables|Full-screen variables]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Image variables &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Images#Defining image items|Defining image items]] and the sections that follow describing types of images&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;%Variables as parameters &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Flow of control in User Language]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Values===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can specify SOUL values by using:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Literals (quoted strings)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Numeric constants &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Field values (values derived from field retrievals)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;%Variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL performs value conversions on values, as described in this article.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic operations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Using values and/or %variables, you can construct expressions to perform arithmetic operations, which are discussed in this article.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Default variable attributes==&lt;br /&gt;
 &lt;br /&gt;
===Model 204 parameters that set default attributes for variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
[[#Model 204 parameters that set default attributes for variables|Model 204 parameters that set default attributes for variables]] lists three &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; parameters that establish the default type, length, and number of decimal places for all types of SOUL variables:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;%variable parameters&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Parameter&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Default&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VTYPE&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Type: &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;, or &amp;lt;var&amp;gt;Undefined&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VLEN&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Length of &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;20&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;VDP&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Number of decimal places in &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td align=&amp;quot;right&amp;quot;&amp;gt;0&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can change the defaults established by these parameters as follows:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The values of VTYPE, VLEN, and/or VDP can be changed by any user for the duration of the terminal session with the &amp;lt;var&amp;gt;RESET&amp;lt;/var&amp;gt; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The value of any of these parameters can be overridden for the duration of a request with the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The variable type, length, and/or number of decimal places for any given variable can be explicitly specified in the declaration statement for that variable. This has the effect of overriding the respective values established by VTYPE, VLEN, and VDP, as well as the values established by the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
VTYPE, VLEN, and VDP are discussed where relevant elsewhere in this article. Also, refer to the&lt;br /&gt;
[[List of Model 204 parameters]] and [[List of Model 204 commands]] for more on user parameters.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Relationship between default values and variable declarations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A variable can be declared:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Explicitly, in a declaration statement (see [[#DECLARE statements for %variables|DECLARE statements for %variables]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Implicitly, in an assignment statement (see [[#Assignment statements|Assignment statements]]). When a variable is declared implicitly, it takes on the attributes established by the VTYPE, VLEN, and VDP parameters (as modified by any &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement that may precede the assignment statement).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variables Are statement===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement overrides, for the remainder of the current request, the default variable type, length, and/or number of decimal places established by the VTYPE, VLEN, and/or VDP parameters, or by an earlier &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. It is particularly useful if you don&#039;t want to rely on VTYPE, VLEN, and VDP, and when most of the %variables used in a request are of the same type and length.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; declaration has no effect on variables which have been declared (either implicitly or explicitly) earlier in the request. The defaults established by a &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement remain in effect until the next &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; declaration or until the end of the request, whichever comes first.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The format of the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Variables Are &lt;br /&gt;
 {Fixed [Dp &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] | Float | String [Len &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] [Dp {&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt; | *}] &lt;br /&gt;
 | Undefined}&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Variables Are Undefined statement====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement forces you to explicitly declare all variables. If this statement is used in a request and &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; encounters an undeclared variable, an error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement sets both the default &amp;lt;var&amp;gt;Len&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Dp&amp;lt;/var&amp;gt; options to 0. Therefore, when &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; is in effect, %variables declared as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; must have the &amp;lt;var&amp;gt;Len&amp;lt;/var&amp;gt; specified or an error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Declaring %variables and %variable arrays==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can declare a variable and subsequently assign and reset that variable any number of times during a SOUL request. You can use a variable declaration statement to specify:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Type of variable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Length of the variable and number of decimal places&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Number of elements if the variable is an array&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use of the optional field save feature &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variable arrays===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables also can be declared to be arrays of up to three dimensions. An element of a %variable array is equivalent to a %variable that is not part of an array. It can be used anywhere that a %variable can be used.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Declare statements for %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
To temporarily set or reset the default variable type, length, and number of decimal places for a particular %variable or %variable array in a request, use the &amp;lt;var&amp;gt;Declare&amp;lt;/var&amp;gt; statement.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the following syntax diagrams, the first declaration statement is for numeric %variables and the second declaration statement is for string %variables&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Syntax for numeric %variables:&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;[Declare] &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variable&amp;lt;/span&amp;gt; [Is] {Fixed [Dp &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;] | Float} &lt;br /&gt;
 [Array(&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d1&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d2&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d3&amp;lt;/span&amp;gt;]])] &lt;br /&gt;
 &amp;amp;#x5b;[[Initial clause in %variable declaration|Initial]](&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;numeric-expression&amp;lt;/span&amp;gt;)] [Static] &lt;br /&gt;
 [Common]&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Syntax for string %variables:&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;[Declare] &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variable&amp;lt;/span&amp;gt; [Is] String [Len &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;]&lt;br /&gt;
 [Dp [&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt; |*}] &lt;br /&gt;
 [Array(&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d1&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d2&amp;lt;/span&amp;gt; [,&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;d3&amp;lt;/span&amp;gt;]])] [No Field Save] &lt;br /&gt;
 &amp;amp;#x5b;[[Initial clause in %variable declaration|Initial]](&#039;&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;EBCDIC-string&amp;lt;/span&amp;gt;&#039; | &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)] [Static] &lt;br /&gt;
 [Common]&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The keyword &amp;lt;var&amp;gt;Declare&amp;lt;/var&amp;gt; is optional. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;var&amp;gt;[[Initial clause in %variable declaration|Initial]]&amp;lt;/var&amp;gt; attribute assigns an initial value to a %variable at compilation time, without using any excess QTBL, STBL, or VTBL space and CPU usage. The &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute is permitted only for numeric expressions or EBCDIC string variables, and not for arrays of any type or DBCS variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute limits assignment to a %variable to the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute and requires the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute to set the %variable&#039;s initial (and only) value.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The various other components of this statement, except for &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt;, are described later in this article; &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; is discussed in [[Subroutines#Common elements|Common elements]].&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If you want to use the &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; attribute on a %variable declaration with the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attributes, the &amp;lt;var&amp;gt;Common&amp;lt;/var&amp;gt; attribute must be the last token in the statement. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%x is float initial (3) static common&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Usage====&lt;br /&gt;
 &lt;br /&gt;
====%Variable Initial value assignment====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value longer than the maximum length results in a compilation warning message:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2493: VARIABLE TOO SMALL FOR INITIAL VALUE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Examples====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following examples use the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In the first example, set %X to the value ABC, using the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute. The value cannot be changed during request evaluation:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%X IS STRING LEN 3 INITIAL(&#039;ABC&#039;) STATIC&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The next example uses a %variable that can be changed during request evaluation:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%Y IS STRING LEN 3 INITIAL(&#039;ABC&#039;)&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The following compiler error message is displayed if you attempt to assign a value to a %variable that has been declared &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt;:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 1 M204.2490: ILLEGAL ASSIGNMENT TO STATIC %VARIABLE&lt;br /&gt;
  %X=5&lt;br /&gt;
  (FILE=CCATEMP, PROCEDURE=0, LINE=3)&lt;br /&gt;
 ==5&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 2 M204.0228: PART OF STATEMENT IGNORED&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.1042: COMPILATION ERRORS&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The next example illustrates using the &amp;lt;var&amp;gt;Static&amp;lt;/var&amp;gt; attribute and an expression with the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; attribute.&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X IS STRING LEN 3 INITIAL(&#039;ABC&#039;) STATIC&lt;br /&gt;
%Y IS STRING LEN 3 INITIAL(&#039;DEF&#039;) STATIC&lt;br /&gt;
%ALPHA IS STRING LEN 6 -&lt;br /&gt;
INITIAL($SUBSTR(%X,2,1) WITH $SUBSTR(%Y,2,1)) STATIC&lt;br /&gt;
PRINT %ALPHA&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;***M204.0542:EDIT COMPLETE - GO&lt;br /&gt;
BE&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===%Variable names===&lt;br /&gt;
A variable name can consist of any number of letters, numbers, and some special characters (for example, underscore). &lt;br /&gt;
&lt;br /&gt;
The first character of the name must be a percent sign (&amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; (period) character is not allowed in the name of a variable that is declared as a &amp;lt;var&amp;gt;[[Json class|Json]]&amp;lt;/var&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
A variable name can have no embedded blanks, colons, or any of the following &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; reserved characters:&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;=&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;+&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;$&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;(&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;,&amp;lt;/b&amp;gt; (not sign &amp;amp;mdash; see Note below)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;)&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&#039;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;-&amp;lt;/b&amp;gt; (minus sign/hyphen)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&amp;lt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;/&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;,&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;:&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; The &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; reserved character is the EBCDIC &amp;quot;not sign,&amp;quot; which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following guidelines apply to certain special characters that are allowed in %variable names:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The @ and # characters also are reserved, unless they are reset by the user through the FLUSH and ERASE parameters.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Dummy string characters (??, ?$, ?&amp;amp;amp;) can be used in variable names, but they perform dummy string substitution, as described in [[Procedures#Using ?$ and ?&amp;amp; dummy strings|Using ?$ and ?&amp;amp; dummy strings]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Relationship to Variables Are statement===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The type, length, and decimal place settings established for a particular %variable by a DECLARE %variable statement are not overridden by a &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement. For example, if the statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %NAME STRING LEN 30&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
is followed by the statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;VARIABLES ARE FIXED&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
then &amp;lt;code&amp;gt;%NAME&amp;lt;/code&amp;gt; remains a string of length 30.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==%Variable types==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be declared as one of several distinct types:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; (fixed-point numeric)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; (floating-point numeric)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; (alphanumeric string)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
And these, as of Version 7.5 of Model 204:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Unicode#The SOUL Unicode type|Unicode]]&amp;lt;/var&amp;gt; (Unicode string)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Longstrings|Longstring]]&amp;lt;/var&amp;gt; (string with very large maximum size) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;[[Object variables|Object]]&amp;lt;/var&amp;gt; (reference to an instance of a class) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A [[Method variables|method variable]] (a variable that references a method)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using Fixed or Float for arithmetic statements===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Defining %variables as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; improves the performance of arithmetic statements. If the result of an arithmetic operation is being assigned to a %variable, the result is not converted before assignment if the arithmetic operands are of the same type.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Arithmetic operations are performed most efficiently if all %variables are defined with matching options: either as &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; or as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, and with no decimal places or the same number of decimal places. To operate &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; as efficiently as possible, avoid mixed-type arithmetic. Use &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variables only when string manipulations are required.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic operation where both operands are &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; requires rules to determine the scale (number of decimal places) of the result. See [[#Fixed precision arithmetic|Fixed precision arithmetic]] for detailed information on the way &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; handles &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; arithmetic operations.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic result types===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
[[#Arithmetic result types|Arithmetic result types]] shows the types and the results for various combinations of operands in an arithmetic statement. The result described in the table refers to the result of an arithmetic operation, which might be an intermediate result. If the final result is being assigned to a %variable of a different type, it is converted to match.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;%Variable types for arithmetic results&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operand 1&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operand 2&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Arithmetic result type&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==%Variable lengths==&lt;br /&gt;
 &lt;br /&gt;
===Fixed %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
%Variables declared as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; can have a decimal place specification associated with them. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;Declare %total Fixed dp 2&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
represents a dollar total. A &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; %variable can contain as many as 15 significant digits, including decimal places. There can be as many as 9 decimal places.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Float %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables declared as &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; are stored as double-precision floating-point numbers. Precision is guaranteed to 15 decimal digits; the exponent must be between 75 and -74. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===String %variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Variables declared as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; can have a maximum length as well as an optional decimal place specification associated with them. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %NAME STRING LEN 20 DP 2&lt;br /&gt;
VARIABLES ARE STRING LEN 7&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The first statement (above) declares the %NAME variable as &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;, with a maximum length of 20 and two decimal places. The second statement sets the defaults for %variables not explicitly declared: &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; with a maximum length of 7 and no decimal places.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Additionally, the decimal place for &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables can be variable by specifying DP *. This causes all decimal digits to be placed in the string. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %AMOUNT IS STRING LEN 10 DP *&lt;br /&gt;
   %AMOUNT = 1.2&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
   %AMOUNT = 1.23&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
   %AMOUNT = 1.234&lt;br /&gt;
   PRINT %AMOUNT&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Yields: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;1.2&lt;br /&gt;
1.23&lt;br /&gt;
1.234&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The maximum length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable is 255 characters. Decimal places, and the decimal point itself, are included in the specified length. Alternatively, the default values for length and decimal places can be used. An attempt to store a value longer than the declared or default length results in truncation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The current length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable is determined by the value put into the &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable. You can use the &amp;lt;var&amp;gt;[[$Len#$Len|$Len]]&amp;lt;/var&amp;gt; function to find the current length of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; variable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the &amp;lt;var&amp;gt;Variables Are Undefined&amp;lt;/var&amp;gt; statement is used, the values for length and decimal places must be specified with each &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable declaration. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==%Variable arrays==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can define %variables as arrays of one, two, or three dimensions with the &amp;lt;var&amp;gt;Declare &amp;lt;i&amp;gt;%variable&amp;lt;/i&amp;gt;&amp;lt;/var&amp;gt; statement. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %CODES STRING LEN 5 ARRAY(100)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a one-dimensional array of up to 100 message codes, each five characters in length.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %TRANSACTION FIXED DP 2 ARRAY(12,10000)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a two-dimensional array of dollar transactions for a store. The array contains up to 10,000 transactions for each of 12 departments.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DECLARE %READINGS FLOAT ARRAY(3,10,80)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
defines a three-dimensional array consisting of up to 80 atmospheric readings of three distinct types from 10 monitoring stations.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Array elements must be of one type===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
All elements of an array must have the same type (&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;, or &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt;) and element length.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===%Variable array references===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An array can be referred to only after it has been declared in an array can have as many as three declared dimensions. A subscript value must be supplied for each dimension. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If a variable is declared as an array, it must always be referenced with subscripts.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Each of the subscript values that refers to a dimension can be a number or an expression. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%CODE(2)&lt;br /&gt;
%READING(3,200-%A/%B,%N)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
As shown in the examples, the expression can contain references to other %variables. The subscript value is converted to an integer. Any fraction is truncated before the subscript value is used as the array subscript. The subscript value must fall within the declared range of dimensions.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===No Field Save option===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable array is declared, you can specify:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;No Field Save&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If you do not intend to use any of the &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; array elements as field name variables, you should select the &amp;lt;var&amp;gt;No Field Save&amp;lt;/var&amp;gt; option, to save space in the user work areas described in [[Large request considerations#STBL (character string table)|STBL (character string table)]]. (Field name variables are discussed in detail on [[#Field name variables|Field name variables]].)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An element of a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; array can be used as a field name variable even if &amp;lt;var&amp;gt;No Field Save&amp;lt;/var&amp;gt; is specified. However, when the value of the element is referred to as a field name, extra processing and additional disk I/O are required for each reference after the first.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Assigning values to %variables==&lt;br /&gt;
 &lt;br /&gt;
===Assignment statements===&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The format of the statement used to calculate and assign the value of %variables is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;syntax&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;%variablename&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The name of the %variable to be set appears to the left of the equal sign and the expression to whose value the %variable is to be set is at the right. (See also [[#Expressions|Expressions]].)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For Large Object data, a compiler error is issued when the right side of the equal sign is expected to contain a BUFFER expression and it does not.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2691: BUFFER ASSIGNMENT MUST REFERENCE LARGE OBJECT FIELD&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and/or&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.2704: BUFFER REFERENCE REQUIRES LOB FIELD&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
These statements are valid assignments:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%AGENT = AGENT&lt;br /&gt;
%NAME = &#039;DALE STERN&#039;&lt;br /&gt;
%RESULT = (%INCREASE + TOTAL PREMIUM) * .01&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note that &amp;lt;code&amp;gt;%AGENT&amp;lt;/code&amp;gt; is legal as a variable name even if &amp;lt;code&amp;gt;AGENT&amp;lt;/code&amp;gt; is a field name in the file. The variable and the field are not related to each other.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Relationship between %variable assignment and declaration===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Normally, an assignment statement precedes a %variable reference in another statement. If a %variable is going to be declared with the &amp;lt;var&amp;gt;Declare &amp;lt;i&amp;gt;%variable&amp;lt;/i&amp;gt;&amp;lt;/var&amp;gt; statement, the declaration must precede the first use of the %variable. If an assignment statement does not precede the %variable reference, or the variable has not been declared, then default values (null values for &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; types, 0 for &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;) are assigned to the %variable.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Truncation vs. rounding on assignment===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In an assignment statement, it is possible for the length of the assigned value to exceed the maximum length for that %variable (as determined in the variable declaration statement, the &amp;lt;var&amp;gt;Variables Are&amp;lt;/var&amp;gt; statement, or the value of the VLEN or VDP parameter). The way &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; treats this situation depends on the %variable type.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; %variables, the assigned value is rounded to 15 significant digits. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; %variables, if the number of places to the left of the decimal point in the assigned value, plus the number of decimal places declared (not assigned) exceeds 15, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; returns an error message and assigns a value of zero. Otherwise, if the number of decimal places assigned exceeds the number declared, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; truncates the assigned value to the number of decimal places declared. For example, the following request:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X IS FIXED DP 0&lt;br /&gt;
%Y IS FLOAT&lt;br /&gt;
%Z IS FLOAT&lt;br /&gt;
%X = 1.9&lt;br /&gt;
%Y = 5&lt;br /&gt;
%Z = %X * %Y&lt;br /&gt;
PRINT &#039;%X = &#039; WITH %X&lt;br /&gt;
PRINT &#039;%Y = &#039; WITH %Y&lt;br /&gt;
PRINT &#039;%X * %Y = &#039; WITH %Z&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
results in this output:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%X = 1&lt;br /&gt;
%Y = 5&lt;br /&gt;
%X * %Y = 5&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The value of %X is truncated from 1.9 to 1 upon assignment for both display and computation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables, if the number of characters in the assigned value exceeds the maximum declared length (or, if not declared, the default length set by the VLEN parameter), the assigned value is truncated to the maximum length allowed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Changing %variable values===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can change the value of a %variable at any point in a request by using an assignment statement. The variable is stored for the duration of the request that assigns it, including any continuations, and is then deleted. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
At the beginning of a request, all %variables are set equal to a null string, or to zero, depending on their types. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
During a request, a %variable can be set equal to another %variable, a quoted string, a number, a field value, a noted value, a function, a count of records or field occurrences, an occurrence number, a null value, or the result of a computation.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===&amp;lt;b id=&amp;quot;initial&amp;quot;&amp;gt;&amp;lt;/b&amp;gt;Understanding Initial processing===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Code written using an &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; assignment for both %variables results in the assigned value of &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; as the &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assigned for &amp;lt;code&amp;gt;%Y&amp;lt;/code&amp;gt; as both assignments are resolved at compilation. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN &lt;br /&gt;
%X IS STRING LEN 1 INITIAL(1)&lt;br /&gt;
 * %X assigned the INITIAL value of 1, at compilation&lt;br /&gt;
%Y IS FIXED INITIAL(%X)&lt;br /&gt;
 * %Y assigned the INITIAL value of %X, at compilation&lt;br /&gt;
PRINT &#039;Y = &#039; %Y&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
Y = 1&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assignment in the format &amp;lt;code&amp;gt;%Y IS FIXED INITIAL (%X)&amp;lt;/code&amp;gt;, will not resolve to the value of &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt;, if &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; was assigned in the format &amp;lt;code&amp;gt;%X=1&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;%X=1&amp;lt;/code&amp;gt; format variable assignments are resolved at evaluation, subsequent to compilation. &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value assignments are resolved at compilation. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following code reflects this processing:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
%X = 1&lt;br /&gt;
 * %X assigned the value of 1 at evaluation &lt;br /&gt;
%Y IS FIXED INITIAL(%X)&lt;br /&gt;
 * %Y assigned the INITIAL value at compilation &lt;br /&gt;
PRINT &#039;Y = &#039; %Y&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
Y = 0&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;%X&amp;lt;/code&amp;gt; value is assigned at evaluation. The &amp;lt;var&amp;gt;Initial&amp;lt;/var&amp;gt; value is assigned at compilation, prior to the evaluation of &amp;lt;code&amp;gt;%X=1,/code&amp;gt;. The result is that &amp;lt;code&amp;gt;%Y&amp;lt;/code&amp;gt; is assigned the default value, zero (0), for its type of &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expressions==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Expressions are evaluated by &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; and used to assign values to %variables and function arguments, or included as operands in computation or conditional statements.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An expression has this format:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;{&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/span&amp;gt; | (&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)} &lt;br /&gt;
 [&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operator&amp;lt;/span&amp;gt; {&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/span&amp;gt; | (&amp;lt;span class=&amp;quot;term&amp;quot;&amp;gt;expression&amp;lt;/span&amp;gt;)}]...&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;operand&amp;lt;/var&amp;gt; is one of the following:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;%%variable (field name variable)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;%variable or element of %variable array&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;COUNT IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Field name&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Function &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Number&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;OCCURRENCE IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted string&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;VALUE IN label&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;operator&amp;lt;/var&amp;gt; can be arithmetic, Boolean, comparison, or concatenation.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Operator order of precedence===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table lists the operators used within expressions in order of precedence. Parentheses can be used to override the order.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Operator order of precedence in expressions&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Order of precedence&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; First&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IS PRESENT, IS NOT PRESENT&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Second&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;- (unary minus)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Third&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;*,/&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Fourth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;+,-&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Fifth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;WITH&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Sixth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;EQ, =, LE, &amp;lt;=, GT, &amp;gt;, GE, &amp;gt;=, NE,  ,=, LT,   IS [NOT] LIKE&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Seventh&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;NOT&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Eighth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;AND&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Ninth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;OR&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Tenth&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;AND (implied by a new line; occurs only in an &amp;lt;var&amp;gt;If&amp;lt;/var&amp;gt; statement) &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;blockquote class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The first character (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;) of the inequality test above is the EBCDIC &amp;quot;not sign&amp;quot;, which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For a description of the &amp;lt;code&amp;gt;IS [NOT] LIKE&amp;lt;/code&amp;gt; clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]]. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Incomplete expressions===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Incomplete expressions, such as the following: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;IF %X = 10 OR %Y &amp;gt; 40 AND %A = %B WITH&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
produce this message: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.0052 ILLEGAL TERM&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Compilation does not succeed and the procedure does not run. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using expressions for value retrieval===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can use expressions for value retrieval in the following SOUL statements:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Update statements (STORE RECORD, ADD, CHANGE, DELETE, INSERT)&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FILE RECORDS&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND - POINT$ condition&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND - SFL$ and SFGE$ conditions&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH RECORD IN ORDER BY&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH RECORD WHERE&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FIND ALL VALUES&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR EACH VALUE&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FOR RECORD NUMBER&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Expression types supported in SOUL statements====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table provides examples of the types of expressions that you can use to supply retrieval values for statements. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Expression types supported in statements&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expression type&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Example&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Function call&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD ORDER.DATE EQ VALUE($DATE(1,&amp;amp;apos;&#039;))&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;String concatenation&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD BIRTH.DATE EQ VALUE(%YYYY WITH %MM WITH %DD)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Arithmetic operation&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD SALES.VALUE EQ VALUE(%ITEM.VALUE * %ITEM.SALES )&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;SOUL construct&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD NUM.ORDERS EQ VALUE(COUNT IN FD.ORDERS)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Boolean expression&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;IN ?&amp;amp;amp;FILE FD ORDER.STATUS EQ VALUE(%STATUS IS LIKE &#039;A*&#039;)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following example shows these different types of expressions used as values.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;B&lt;br /&gt;
%MM IS STRING LEN 2&lt;br /&gt;
%DD IS STRING LEN 2&lt;br /&gt;
%BASE.PREMIUM IS FLOAT&lt;br /&gt;
%PCT.INCREASE IS FLOAT&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* function call expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD1&#039;&lt;br /&gt;
FD1:&lt;br /&gt;
IN CLIENTS FPC INCIDENT DATE EQ -&lt;br /&gt;
   VALUE($DATECHG(&#039;YYYYMMDD&#039;,$DATE(1,&amp;amp;apos;&amp;amp;apos;),-3169))&lt;br /&gt;
        END FIND&lt;br /&gt;
FR FD1&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* string concatenation expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD2&#039;&lt;br /&gt;
%MM = &#039;09&#039;&lt;br /&gt;
%DD = &#039;17&#039;&lt;br /&gt;
FD2:&lt;br /&gt;
IN CLIENTS FPC ANNIV DATE EQ VALUE(%MM WITH %DD)&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD2&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* arithmetic operation expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD3&#039;&lt;br /&gt;
%BASE.PREMIUM = 1280&lt;br /&gt;
%PCT.INCREASE = 1.25&lt;br /&gt;
FD3:&lt;br /&gt;
IN CLIENTS FPC TOTAL PREMIUM EQ VALUE(%BASE.PREMIUM * %PCT.INCREASE)&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD3&lt;br /&gt;
   PAI&lt;br /&gt;
FEO1:&lt;br /&gt;
   FEO VIN&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* UL syntax expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
  PRINT &#039;FD4&#039;&lt;br /&gt;
FD4:&lt;br /&gt;
  IN VEHICLES FPC VIN EQ VALUE(VALUE IN FEO1)&lt;br /&gt;
        END FIND&lt;br /&gt;
  FR FD4&lt;br /&gt;
     PAI&lt;br /&gt;
     PRINT&lt;br /&gt;
  END FOR&lt;br /&gt;
   END FOR&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* boolean expression&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*&lt;br /&gt;
PRINT &#039;FD5&#039;&lt;br /&gt;
FD5:&lt;br /&gt;
IN CLIENTS FPC INCIDENT EQ VALUE(&#039;T&#039; WITH (%DD IS LIKE &#039;1*&#039;))&lt;br /&gt;
     END FIND&lt;br /&gt;
FR FD5&lt;br /&gt;
   PAI&lt;br /&gt;
   PRINT&lt;br /&gt;
END FOR&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Operators==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This section describes the use of four types of operators:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Arithmetic&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Comparison&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Boolean&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;With&amp;lt;/var&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
See the previous section for a discussion of expressions, and the next section for a discussion of operands. See [[#Fixed precision arithmetic|Fixed precision arithmetic]] for a more detailed discussion.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Arithmetic operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following table lists the arithmetic operators:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;+&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Addition&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;-&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Subtraction, unary minus&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;*&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Multiplication&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;/&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Division &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Order of operations====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The arithmetic operators are used to compute the value of a %variable or they can be included in an expression. When an expression contains several arithmetic operations, the operations are performed in the order shown in [[#Operator order of precedence|Operator order of precedence]]. Operators of equal precedence are evaluated in order of appearance, from left to right. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%result = 8*7 + 4 &amp;lt;/p&amp;gt;&lt;br /&gt;
sets &amp;lt;code&amp;gt;%result&amp;lt;/code&amp;gt; to 60.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Parentheses change the order of operations; expressions within parentheses are compiled first. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;4-5*2*3 = -26&lt;br /&gt;
(4-5)*(2*3) = -6&lt;br /&gt;
(4-(5*2))*3 = -18&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Arithmetic overflow====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic overflow might occur during evaluation of a computation statement. If such an overflow occurs, the request is cancelled and an appropriate error message is issued.&amp;lt;/p&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Comparison operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following comparison operators are used to compare two objects, two strings, two numbers, or a string and a number:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;EQ, = &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Equal&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;NE, ^= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Not equal&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;GT, &amp;gt; &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Greater than&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;LT, &amp;lt; &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Less than&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;GE, &amp;gt;= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Greater than or equal to&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;LE, &amp;lt;= &amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Less than or equal to&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;IS [NOT] LIKE&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Pattern matching equivalents&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;IS [NOT] PRESENT&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Field existence&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
When a comparison operator is included in an expression, a value of 1 results if the stated relation between operands is true; if false, a value of 0, provided that &amp;lt;i&amp;gt;one&amp;lt;/i&amp;gt; of the following conditions apply (using the expression &amp;lt;code&amp;gt;%I = (%A&amp;lt;=%B)&amp;lt;/code&amp;gt; to illustrate): &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Either %A or %B (or both) is declared as &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Either %A or %B (or both) is signed in the expression; for example,&lt;br /&gt;
&amp;lt;code&amp;gt;%I = (+%A &amp;lt;=%B)&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;VTYPE = FLOAT or FIXED, and VLEN is greater than zero.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The resulting value returned from the expression might be invalid if &amp;lt;i&amp;gt;all&amp;lt;/i&amp;gt; the following conditions apply:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Neither %A nor %B is declared.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The expression does not sign the variable.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The system default for VTYPE is &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; and VLEN is greater than zero.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;See the discussion about the conditional statement in [[Flow of control in User Language#Comparison operators|Comparison operators]] for a description of these operators in conditional statements. &amp;lt;/li&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;li&amp;gt;The first character (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;) of the inequality test above is the EBCDIC &amp;quot;not sign&amp;quot;, which has the hexadecimal value &amp;lt;code&amp;gt;5f&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For a description of the &amp;lt;code&amp;gt;IS [NOT] LIKE&amp;lt;/code&amp;gt; clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Boolean operators===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Use the Boolean operators listed in the following table to modify or link together comparison expressions. (See the discussion about [[Flow of control in User Language#Boolean operators|Boolean operators and conditional statements]] for information on comparisons.)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;thJustBold&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;caption&amp;gt;Boolean operators&amp;lt;/caption&amp;gt;&lt;br /&gt;
&amp;lt;tr class=&amp;quot;head&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Meaning&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Not&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;The value of the comparison is reversed.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;And&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Both comparisons must be true.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Or&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Either comparison must be true. &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Boolean operators are not restricted to comparisons. They also can be used in the middle of expressions (for example, &amp;lt;code&amp;gt;1 AND 2&amp;lt;/code&amp;gt;).&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===With operator===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;var&amp;gt;With&amp;lt;/var&amp;gt; can be used in an expression to concatenate two strings. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%A = &#039;$&#039; WITH TOTAL PREMIUM&lt;br /&gt;
PRINT %A TO COLUMN 10&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
results in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;$550&lt;br /&gt;
$1092&lt;br /&gt;
$605&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Operands==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This section describes the use of four types of operands: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;%variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted strings&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Numbers&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fields&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
See also&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Expressions|Expressions]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Operators|Operators]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Fixed precision arithmetic|Fixed precision arithmetic]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Variables as operands===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
After you define a %variable, you can use it to change other %variables. For example: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = %NUM&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
sets &amp;lt;code&amp;gt;%COUNT&amp;lt;/code&amp;gt;, and:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = %COUNT + 1&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
replaces the value of %COUNT&amp;lt;code&amp;gt;%COUNT&amp;lt;/code&amp;gt; by its former value plus 1. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Quoted strings===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Examples of %variables set to quoted strings are provided here:  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%NAME = &#039;TETLEY&#039;&lt;br /&gt;
%AGE = &#039;53&#039;&lt;br /&gt;
%TITLE = &#039;QUARTERLY REPORT&#039;&lt;br /&gt;
%SPOUSE = &#039;&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the preceding example, &amp;lt;code&amp;gt;%SPOUSE&amp;lt;/code&amp;gt; is a quoted string that has a length of 0. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Additional information about the use of quotation marks is provided in [[Request composition rules#Quotation marks|Quotation marks]].&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Numbers===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A number used as the value of a %variable or as a term in an expression can be a string of digits containing an optional sign and an embedded decimal point.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;3     +0.002&lt;br /&gt;
45.7  -37&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The magnitude of the number is limited by the magnitude of the largest number that can be represented in a floating point number. Therefore the number&#039;s exponent (if the number is expressed in exponent notation) must be between 75 and -74.  &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Fields===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Field values, referred to by field name, can be used in an assignment statement, but only inside a FOR EACH RECORD loop. To evaluate an expression, &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; uses the value of the field for the current record each time through the loop. For example: &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;FOR EACH RECORD IN FIND.RECS&lt;br /&gt;
   %PROFIT = %INCREASE - TOTAL PREMIUM&lt;br /&gt;
   PRINT %PROFIT&lt;br /&gt;
END FOR&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
calculates profit from the data in each record and prints it. &amp;lt;code&amp;gt;%PROFIT&amp;lt;/code&amp;gt; changes for each record.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In expressions, the values of most types of fields are treated as character strings. The values of fields defined with the FLOAT attribute are treated as numbers. If a field is missing from a record being processed, the value used is a null string. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Fixed precision arithmetic==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An arithmetic operation where both operands are &amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; requires rules to determine the scale (maximum numbers of digits and decimal places) of the result.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Scale of intermediate results===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; determines the scale of intermediate results (the number of decimal places) using the following rules.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Addition and subtraction====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires either addition or subtraction, the scale of the temporary variable containing the result equals the larger of the scales of the two operands. For example, the scale for the result of the following expression is 3:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12.345 + 3.6&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the result exceeds 15 digits, decimal places are dropped from the right to produce the largest possible scale that fits in 15 digits. If a 15 digit number cannot be produced even by dropping all decimal places, an overflow condition is indicated.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Multiplication====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires multiplication, the scale of the temporary variable containing the result is equal to the sum of the scales of the two operands. For example, the scale for the result of the following expression is 5 (3+2):&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12.345 * 3.64&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the sum of the scales of the operands exceeds 9 or if the result is larger than 15 digits, decimal places are dropped from the right to produce the largest possible scale that fits in 15 digits. As with addition and subtraction, if the result has more than 15 digits with all decimal places discarded, an overflow condition is indicated.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Division====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When an expression requires division, the scale of the temporary variable containing the result is equal to the larger of:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;9&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;the largest possible scale that fits in 15 digits&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example, the scale for the result of this expression is 9 (the calculated result is 3.529411764):&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;12 / 3.4&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Causes of overflow conditions===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following situations are treated as overflow conditions:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;When the integer portion of any intermediate or final result is larger than 15 digits.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;For addition and multiplication, when the scale of the final result variable is so large that the integer portion of the result cannot fit into the maximum allotted size. For example:&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %A IS FIXED DP 0&lt;br /&gt;
   %B IS FIXED DP 0&lt;br /&gt;
   %C IS FIXED DP 9&lt;br /&gt;
   %A = 999999&lt;br /&gt;
   %B = 1&lt;br /&gt;
   %C = %A + %B&lt;br /&gt;
PRINT &#039;C = &#039; %C&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0552: VARIABLE TOO SMALL FOR RESULT&lt;br /&gt;
C = 0.000000000&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Because the scale of the variable which contains the final result (%C) is 9, the integer portion of the result is limited to no more than 6 digits. Because the integer portion of the result requires 7 digits, an overflow condition is triggered.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This example illustrates that &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; takes into consideration the scale of the final result variable. The example below is identical to the one above except that the scale of %C is set to 8. The request executes successfully because this frees the required 7 digits for the integer portion of the result:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %A IS FIXED DP 0&lt;br /&gt;
   %B IS FIXED DP 0&lt;br /&gt;
   %C IS FIXED DP 8&lt;br /&gt;
   %A = 999999&lt;br /&gt;
   %B = 1&lt;br /&gt;
   %C = %A + %B&lt;br /&gt;
PRINT &#039;C = &#039; %C&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
C = 1000000.00000000&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===How Model 204 responds to overflow conditions===&lt;br /&gt;
 &lt;br /&gt;
====Overflowing to zero====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; detects an overflow condition, the intermediate result is set to 1015. Since this is a 16-digit number, it is illegal in SOUL and tends to cause a cascade of overflow conditions in a complex expression, which can generate the following error message:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;M204.0552: VARIABLE TOO SMALL FOR RESULT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The final result of the expression is usually 0, which lets you see that an overflow error might have occurred. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Overflowing to very large, obviously incorrect number====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An exception to the rule of a 0 final result is the case where an overflow occurs in an intermediate step and the next step (whether intermediate or final) involves subtracting a value whose scale is 0 so that the result is less than 1015. In this case, you get a large, incorrect, result. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
   %X IS FIXED DP 0&lt;br /&gt;
   %Y IS FIXED DP 0&lt;br /&gt;
   %Z IS FIXED DP 0&lt;br /&gt;
   %X = 10E13&lt;br /&gt;
   %Y = 350000&lt;br /&gt;
   %Z = 10&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;* (%X * %Y) WILL OVERFLOW AND BECOME 10E15&lt;br /&gt;
   %X = (%X * %Y) - %Z&lt;br /&gt;
PRINT &#039;X =&#039; %X&lt;br /&gt;
END&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** M204.0542: EDIT COMPLETE - GO&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;*** 1  M204.0563: ARITHMETIC OVERFLOW&lt;br /&gt;
X = 999999999999990&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Value In, Count In, and Occurrence In phrases==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can set a %variable value based on the following elements of a SOUL request:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Value In&amp;lt;/var&amp;gt; phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to a noted value, as illustrated below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%DRIVER = VALUE IN NOTE.DRIVER&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This phrase also can be included in an expression or used to include the current value in a &amp;lt;var&amp;gt;For Each Occurrence&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;For Each Value&amp;lt;/var&amp;gt; loop.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;COUNT IN phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to the number of records counted, as in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%COUNT = COUNT IN NO.OF.VINS&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This phrase also can be included in an expression. &amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;OCCURRENCE IN phrase&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A %variable can be set equal to the subscript value of the current occurrence of a field in a record, as in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%OCCUR = OCCURRENCE IN INCIDENT.TYPE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
where INCIDENT.TYPE is the statement label of a &amp;lt;var&amp;gt;For Each Occurrence&amp;lt;/var&amp;gt; statement. This phrase also can be included in an arithmetic expression.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Conversions and significant digits==&lt;br /&gt;
 &lt;br /&gt;
===Numeric terms===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following expression terms are considered numeric:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Literal (unquoted) numbers: -3, .0079&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Count In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Occurrence In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Some functions (see [[List of mathematical $functions]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Results of numeric expressions&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Fixed&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;Float&amp;lt;/var&amp;gt; %variables&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;FLOAT fields &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Character terms===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following expression terms are considered character:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Quoted strings: &#039;SMITH&#039;, &#039;.0079&#039;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Non-FLOAT fields: NAME, ADDRESS&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;Value In&amp;lt;/var&amp;gt; phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Some functions (see [[M204wiki main page#$Functions|$Functions]])&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variables &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Conversion===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the expression &amp;lt;code&amp;gt;AGE + 10&amp;lt;/code&amp;gt;, the value of the field AGE (character) is added to a literal number (numeric). &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; converts the value of AGE to a number. If the value is a proper number (for example, 5, -3.943, +.0003), the conversion is obvious; if not, the value is not a proper number (for example, FIVE, &amp;quot;, ABCD) or a number with too many digits, it is converted to a zero.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In the expression &amp;lt;code&amp;gt;&#039;NUMBER&#039; WITH -3.8&amp;lt;/code&amp;gt;, a quoted string is to be concatenated with a number. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; first converts the number to a character string. In such a conversion, all decimal places are lost; the number is truncated to an integer and the result is NUMBER-3.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Significant digits in computations===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
SOUL can accept as input to computations the largest floating point number that can be expressed in exponent notation and can produce results of that magnitude. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
However, all results contain at most 15 significant decimal digits, with zeros in the low-order positions. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; preserves 15 digits in all intermediate results, rounding each result to 15 digits before going on to the next intermediate calculation. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the final result is assigned to a &amp;lt;var&amp;gt;String&amp;lt;/var&amp;gt; %variable, that result is truncated on the right to the maximum length specified for the %variable. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Sample request using %variables==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following request illustrates an assignment statement. The request computes the total settlement amount for each claim type within a file. Output consists of a 2-column table, giving a total amount for each type as well as a grand total settlement amount. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
            VARIABLES ARE STRING DP 2&lt;br /&gt;
            SET HEADER 2 &#039;TOTAL&#039; TO COLUMN 34&lt;br /&gt;
            SET HEADER 3 &#039;CLAIM TYPE&#039; -&lt;br /&gt;
               WITH &#039;SETTLEMENT AMOUNT&#039; TO COLUMN 40&lt;br /&gt;
            SET HEADER 4&lt;br /&gt;
            NEW PAGE&lt;br /&gt;
EACH.TYPE:  FOR EACH VALUE OF CLAIM TYPE&lt;br /&gt;
TYPE.MATCH:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                  CLAIM TYPE = VALUE IN EACH.TYPE&lt;br /&gt;
               END FIND&lt;br /&gt;
               FOR EACH RECORD IN TYPE.MATCH&lt;br /&gt;
                  %TOT = %TOT + SETTLEMENT AMOUNT&lt;br /&gt;
               END FOR&lt;br /&gt;
               PRINT VALUE IN EACH.TYPE AT COLUMN 6 -&lt;br /&gt;
                  WITH %TOT TO COLUMN 36&lt;br /&gt;
               %GRANDTOT = %GRANDTOT + %TOT&lt;br /&gt;
               %TOT = 0&lt;br /&gt;
            END FOR&lt;br /&gt;
            SKIP 1 LINE&lt;br /&gt;
            %GRANDTOT = &#039;$&#039; WITH %GRANDTOT&lt;br /&gt;
            PRINT &#039;GRAND TOTAL:&#039; WITH %GRANDTOT TO COLUMN 36&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note that the user resets the value of &amp;lt;code&amp;gt;%TOT&amp;lt;/code&amp;gt; to 0 after each pass through the value loop. Because %variables retain their values until explicitly reset, the user is responsible for clearing %variables that are to be reused. &amp;lt;var class=&amp;quot;product&amp;quot;&amp;gt;Model&amp;amp;nbsp;204&amp;lt;/var&amp;gt; does not perform this type of housekeeping routine automatically.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The output resulting from the preceding request is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;                             TOTAL&lt;br /&gt;
CLAIM TYPE              SETTLEMENT AMOUNT&lt;br /&gt;
 &lt;br /&gt;
     O                      52905.00&lt;br /&gt;
     C                      53310.00&lt;br /&gt;
     L                      51773.00&lt;br /&gt;
 &lt;br /&gt;
GRAND TOTAL:              $157988.00&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Using %variables in place of the Note statement==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In most cases the &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement can be replaced with an assignment statement to achieve the same results. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In this example, &amp;lt;code&amp;gt;POLICY NO&amp;lt;/code&amp;gt; is assigned to a variable rather than a &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
POL.HOLDERS: FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                RECTYPE = POLICYHOLDER&lt;br /&gt;
             END FIND&lt;br /&gt;
             FOR EACH RECORD IN POL.HOLDERS&lt;br /&gt;
                %POLICY.NO = POLICY NO&lt;br /&gt;
EACH.POL.NO:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                   POLICY NO = %POLICY.NO&lt;br /&gt;
                   RECTYPE = DRIVER&lt;br /&gt;
                END FIND&lt;br /&gt;
                FOR EACH RECORD IN EACH.POL.NO&lt;br /&gt;
                   PRINT %POLICY.NO AND FULLNAME&lt;br /&gt;
                END FOR&lt;br /&gt;
             END FOR&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Caution:&amp;lt;/b&amp;gt; Some caution is required when substituting %variables for &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement values. The &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement retains up to 255 characters, while an undeclared %variable retains only the default length set by the &amp;lt;var&amp;gt;VLEN&amp;lt;/var&amp;gt; parameter. If a %variable is used for a long field value, the length parameter for the %variable must be reset to avoid truncation.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Impact on STBL space===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Another difference between %variables and &amp;lt;var&amp;gt;Note&amp;lt;/var&amp;gt; statement values is the use of space in the system work area STBL. For more information on STBL, refer to [[Large request considerations#STBL (character string table)|STBL (character string table)]].&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Field name variables==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Field name variables permit indirect reference to field names, thereby permitting many procedures and requests to be generalized without using dummy strings (refer to [[Procedures#Dummy strings in procedures|Dummy strings in procedures]] for a discussion). The actual field names used in a particular procedure or request are specified when the request is executed. Field name variables are extensions of the %variables described in the preceding section. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Syntax====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A field name %variable is indicated in this format:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%name&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%DISCOUNT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Using field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
During the evaluation phase of a request, a string value can be assigned to a %variable:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%DISCOUNT = &#039;DISCOUNT&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and that %variable can then be used in SOUL statements where field names normally appear, as in this example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;ADD.REC: STORE RECORD&lt;br /&gt;
            %%DISCOUNT = .055&lt;br /&gt;
         END STORE&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
A field name variable and a variable with identical names are actually the same variable. When the variable is used in %variable context (for example, on the left hand side of an assignment statement), it takes the usual %name form. If the same variable is used in a field name context (for example, to the left of an equal sign (=) in a FIND condition), it takes the %%name form. In the latter case, the value of the variable (when the &amp;lt;var&amp;gt;Find&amp;lt;/var&amp;gt; statement is evaluated) is used as the field name. &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;BEGIN&lt;br /&gt;
START.REQUEST: %A = $READ(&#039;ENTER FIELD NAME&#039;)&lt;br /&gt;
IF.QUIT:      IF %A EQ &#039;QUIT&#039; THEN&lt;br /&gt;
                 JUMP TO STOP.REQUEST&lt;br /&gt;
              END IF&lt;br /&gt;
              %B = $READ(&#039;ENTER VALUE&#039;)&lt;br /&gt;
MATCH.SET:    FIND ALL RECORDS FOR WHICH&lt;br /&gt;
                 %%A = %B&lt;br /&gt;
              END FIND&lt;br /&gt;
              FOR EACH RECORD IN MATCH.SET&lt;br /&gt;
PRINT.INFO:      PRINT &#039;RECNO &#039; WITH RECNO -&lt;br /&gt;
                    WITH %A AT COLUMN 15 AND %%A&lt;br /&gt;
              END FOR&lt;br /&gt;
              JUMP TO START.REQUEST&lt;br /&gt;
STOP.REQUEST: PRINT &#039;END OF REQUEST&#039;&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the file consists of these two records:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;RECNO = 1       RECNO = 2&lt;br /&gt;
AGE = 23        AGE = 1&lt;br /&gt;
WEIGHT = 146    WEIGHT = 23&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
and the user replies to the $READ prompts with:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;AGE&lt;br /&gt;
23&lt;br /&gt;
WEIGHT&lt;br /&gt;
23&lt;br /&gt;
QUIT&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The output from the request is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;RECNO 1         AGE 23&lt;br /&gt;
RECNO 2         WEIGHT 23&lt;br /&gt;
END OF REQUEST&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The START.REQUEST and IF.QUIT statements use %A as a variable. When %A is used as a field name variable in the FIND condition of the MATCH.SET statement, it appears as %%A. In the PRINT.INFO statement, both %A and %%A are used. First the value of %A (the string value that represents the field name) is printed. Then %%A is used as a field name, printing the value of that field within the record.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Assigning values to field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You need to be aware of the difference between the following statements:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;FIELD.VAR: %a = EMPLOYEE NUM&lt;br /&gt;
 &lt;br /&gt;
STRING.VAR: %a = &#039;EMPLOYEE NUM&#039;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The FIELD.VAR statement assigns the value of the field named EMPLOYEE NUM from the current record to %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;. The FIELD.VAR statement must appear within a &amp;lt;var&amp;gt;For Each Record&amp;lt;/var&amp;gt; loop. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
In contrast, the STRING.VAR statement assigns the character string &amp;lt;code&amp;gt;EMPLOYEE NUM&amp;lt;/code&amp;gt; as the value of %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;. If %variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is to be used subsequently as a field name variable, it must contain a valid field name for the file(s) being examined by the request. &amp;lt;/p&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
===Subscripted field name variables===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can use subscripts with field name variables, as discussed in [[Processing multiply occurring fields and field groups#Subscripts|Subscripts]]. This is often useful in specifying indirect references to particular occurrences of multiply occurring fields. Any field name variable can be followed by a parenthesized expression. The value of this expression is used as a subscript that specifies the desired occurrence of the named field. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example, the field name variable reference:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%DISCOUNT(5)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
refers to the fifth value of the field represented by the field name variable, %%DISCOUNT.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The evaluation of subscript expressions is subject to the rules of assignment to an integer discussed earlier in this section.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
It is also possible for the field name variable being subscripted to be an element of an array. The format of such a reference is:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%variable (a1 [, a2 [, a3] ]) (n)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
where a1, a2, and a3 are the subscripts of the array, and n is the occurrence subscript. For example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;%%ITEM(3,5) (4)&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
indicates the fourth occurrence of the field. The actual value of the field name variable is saved as the element of the array, %ITEM, with subscripts (3,5). &amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
===Resolution of field types and levels===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Some statements operate only on fields of a particular type. Such requirements usually are enforced when a request is compiled. The use of field name variables defers error checking until the request is evaluated and the values of the variables are known. The value of a field name variable is checked for the same errors as field names known at compilation time (a reference to an undefined field, an attempt to print an &amp;lt;var&amp;gt;INVISIBLE&amp;lt;/var&amp;gt; field, a length error on a preallocated field, or a security access violation). If an error is detected the request evaluation is cancelled.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
====Possible file inconsistency====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Cancellation of a request during a sequence of statement updates could leave a file in a logically inconsistent state. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This occurs if a change is made before an incorrect reference to a field name variable, and also before a dependent change is made. A request that stores records using field name variables for some fields, or a request that operates on fields with security levels, could leave a file in an inconsistent state if an error occurs for one or more of the fields. The result might be a record without some or all of its fields. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The field type and security level of a variable can be checked before updating by using the &amp;lt;var&amp;gt;[[$Dscr]]&amp;lt;/var&amp;gt;, &amp;lt;var&amp;gt;[[$FlsAcc]]&amp;lt;/var&amp;gt;, and &amp;lt;var&amp;gt;[[$FlsChk]]&amp;lt;/var&amp;gt; functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- end of toc limit div --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:SOUL]]&lt;/div&gt;</summary>
		<author><name>SSmirnova</name></author>
	</entry>
</feed>