Please enable JavaScript to view this site.

ESL Documentation

Definition

Define a variable.

[global]

{ integer [variable]

| float [variable]

| boolean [variable]

string [variable] }

VAR1 [is VALUE1] [VAR2 [is VALUE2]]...

global

This is a global variable. When one program transfers control to another program, the values of the global variables are retained and are available for use by the new program. All programs that use a global variable must define it as a global variable, specifying the same name and the same type. If a program executed with the change to program action statement initializes the global variable, the initialization does not override the value left behind by any earlier program.

VARn

The identifier for a variable name.

VALUEn

A compile-time value of the same type as the associated variables, representing the initial values of the variables.

Description

A variable is a named entity that holds a data value that can be changed during execution. Once defined, it can be referenced in the program (or in other programs to which control has been transferred, if the variable is defined as global in both programs).

The variable statement defines one or more variables. A variable must be defined before it is referenced.

When you define a variable, you must specify the name, type, and, optionally, its initial values. The type that you specify for a variable determines the type of value required for the initialization. You do not need to initialize variables when you define them. The following table lists the default initialization values for variables:

Type

Default Initialization

integer

0

float

0.00

boolean

false

string

"" (null string)

The maximum size for an ESL variable name is 255 characters.

Successful comparison of string variable values requires that both values be exactly the same. Neither value may contain trailing blanks.

If you specify string or variable alone, ESL assumes string variable.

If the variable is not defined as global, the variable defaults to a local variable. In a local variable, the value assigned will be retained only while that program is executing.

If the program is compiled with External Strings, then the initial value of string variables will be externalized.

Limits

The following table lists the value ranges for the different types of variables:

Type

Value Range

integer

-2,147,483,648 to 2,147,483,647

float

2.2E-308 to 1.8E+308 (15-digit precision)

string

2,147,483,646 characters

Example

integer variable MaxHeight_IV is 10000

 

global variable Message_SV

 

boolean SuccessFlag_BV is true

 

variable City_SV is "BOSTON"

State_SV is "MA"

Country_SV is "USA"

See Also

append Action Statement

Array Definition and Reference

change to program Action Statement

copy Action Statement

extract from Action Statement

length of Special Inquiry Built-in Function