Declarations and Initialization

The variables that you define in the declarations section are used to store values. Variables consist of a name and a data type. Variable names can include alphanumeric characters and the colon (:) and underscore (_). The first character in a variables name may not be a numeric. All variable names are case-sensitive.

Notes:
  • A declaration must be terminated with a semicolon (;). To improve readability, you typically include a blank link in between the declaration and statement sections.
  • In maps, the Translator does not initialize extended rule variables. You must initialize all variables after declaring them. Variables that are not initialized can cause incorrect results or translation failures. For forms, initialization is not necessary.
Table 1. Data types that supported by extended rules
Data Type Description Example
Integer a whole number with no decimal component Declare i as an integer and initialize.
integer i;  //Declaration
i = 0;      //Initialization of ‘i’
Real a whole number that may have a decimal component Declare r as a real number and initialize.
real r;     //Declaration
r = 0;      //Initialization of ‘r’
String contains one or more printable characters Declare s as a 20-character string and initialize.
string[20] s;  //Declaration
s = "";        //Initialization of ‘s’
Datetime contains a date or time Declare d as a date or time and initialize.
datetime d;      //Declaration
d = date(0,0,0); //Initialization of ‘d’
Array defines a table of multiple occurrences of a single data type Declare a as an array of 10 integers and initialize.
integer a[10]; //Declaration
integer i;     //Declaration of ‘i’, which is
               //used to initialize array ‘a’
i = 1;         //Initialization of ‘i’
//Initialization of the variable array ‘a’
while i < 11 do
begin
           a[i] = 0;
           i = i + 1;
end

Declare p as an array of 50 10-character strings and initialize.

string[10] p[50]; //Declaration
integer i;        //Declaration of ‘i’, which is
                  //used to initialize array ‘p’
i = 1;            //Initialization of ‘i’
//Initialization of the variable array ‘p’
while i < 51 do
begin
           p[i] = "";
           i = i + 1;
end
Object

(for maps only)

used for user exits; exposes the internal functions of an ActiveX Automation Server to Sterling Gentran:Server® Declare ob as an object and initialize.
object ob;    //Declaration
ob = CreateObject("ADODB.Connections");
              //Initialization of ‘ob’