Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>ICAM</strong> <strong>Virtual</strong> <strong>Machine</strong> ® <strong>Virtual</strong> <strong>Machine</strong> Reference, Model Customization<br />
The Macro Language, Fundamentals of the Macro Language<br />
For example:<br />
$$ a global untyped variable named LU1<br />
DECLAR/GLOBAL,LU1<br />
$$ a global logical variable array size 10<br />
DECLAR/GLOBAL,LOGICAL,FLAG(10)<br />
$$ 3 local variables that can only hold real values<br />
DECLAR/LOCAL,REAL,X1,Y1,Z1<br />
It is illegal to specify a predefined variable name in a DECLAR command. For example, any<br />
variable with a leading “%” symbol or “$” symbol is predefined and cannot appear in a<br />
DECLAR command. In addition, once a variable is declared it in effect becomes “predefined”<br />
and must not be declared again. That is why it is recommended that all global declarations be<br />
placed in the model startup macro, where they are only declared once.<br />
Array Declaration (RESERV)<br />
The RESERV command is used to define a variable as being an array (the DECLAR command<br />
can also be used for the same purpose). The basic syntax is as follows:<br />
RESERV<br />
/<br />
1 : n<br />
� � � �<br />
, variable _name,<br />
elements , length<br />
The “elements” is a whole number specifying how many elements there are in the named variable.<br />
If the array is to hold text strings, a second whole number can be given specifying the length<br />
of each string in the string array. If “length” is omitted for a string array, the length will be<br />
determined based on the first assignment operation.<br />
To refer to a specific element in an array variable, specify the element number within parentheses<br />
immediately following the array variable name. The element number can be specified either<br />
as a numeric constant or by an expression that returns a numeric result.<br />
An array of 10 elements is defined in the following example. The first element is assigned a<br />
value of 1 (one). Each subsequent element is double the value of the preceding one.<br />
DECLAR/GLOBAL,A1<br />
RESERV/A1,10<br />
A1(1)=1<br />
DO/I=2,10<br />
A1(I)=2*A1(I-1)<br />
ENDOF/DO<br />
128 <strong>ICAM</strong> Technologies Corporation – Proprietary