10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VariablesHow You Can Declare Simple VariablesThe syntax for declaring a simple variable is:name = datatype [with null|not null] [not default|with default|[with] defaultdefaultvalue]The following example shows a local variable declaration for an integervariable:i = integer;By default, all simple variables are nullable. If you do not want the variable tobe nullable, you must include the not null clause in the declaration, forexample:i = integer not null;By default, all numeric simple variables are assigned a default value of zero,and all character simple variables are assigned a default value of the emptystring (''). If you want to specify a different default value, you must include thedefault clause. The default value must be null, a literal, or one of the systemconstants defined in the Language Reference <strong>Guide</strong> online help, for example:i = integer not null default false;How You Can Reference Simple VariablesThe with null, not default, and with default (without a value) clauses areprovided for syntactic compatibility with SQL, but they have no effect inOpenROAD.To reference a simple variable, use the variable name. For example, to assignthe value of Smith to the person variable, use the following statement:person = 'Smith';Individual elements in a reference variable or an array can be simple variables,as shown in the illustration in Variables (see page 25). In this illustration, Filmis a reference variable with three attributes. Each of these attributes is asimple variable. Similarly, Movies is an array and each individual element inthe array is a simple variable.In a 4GL script, you can use simple variables as reference or array variableelements in any context that you can use other simple variables, for example:film.director = 'Hitchcock';if movies[].title = 'ANNIE HALL' then ...Language Elements 27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!