Each EGL function is composed of zero to many EGL statements of the following
kinds:
- A variable declaration or constant
declaration provides access to a named area of memory. The value
of a variable can be changed at run time; the value of a constant cannot.
Either kind of declaration can be anywhere in a function except in a block,
as described later.
- A function invocation directs processing to a function, as in this
example:
myFunction(myInput);
Recursive calls are
valid.
- An assignment statement can copy any of the following values into
a variable:
- Data from a constant or variable
- A literal
- A value returned from a function invocation
- The result of an arithmetic calculation
- The result of a string concatenation
Examples of assignment statements are as follows:
myItem = 15;
myItem = readFile(myKeyValue);
myItem = bigValue - 32;
record1.message = "Operation " + "successful!";
- A keyword statement provides additional functionality such as file
access. Each of these statements is named for the keyword that begins the
statement; for example:
add record1; // an add statement
return (0); // a return statement
- A null statement is a semicolon that has no effect but may be useful
as a placeholder, as in this example:
if (myItem == 5)
; // a null statement
else
myFunction(myItem);
end
Non-null EGL statements have the following characteristics:
- A statement can reference named memory areas, which are of these kinds:
- Form
- PageHandler
- Record
- DataTable
- Item (a category that includes data items, as well as structure items
in records, forms, and tables)
- Array (a memory area based on a structure item that has an occurs value
greater than 1)
- A statement can include these kinds of expressions--
- A datetime expression resolves to a date, integer, interval, or
timestamp
- A logical expression resolves to true or false
- A numeric expression resolves to a number, which may be signed
and include a decimal point
- A string expression resolves to a series of characters, which may
include single-byte characters, double-byte characters, or a combination of
the two
- A statement either ends with a semicolon or with a block, which
is a series of zero or more subordinate statements that act as a unit. Block-containing
statements are terminated with an end delimiter, as in this example:
if (record2.status= "Y")
record1.total = record1.total + 1;
record1.message = "Operation successful!";
else
record1.message = "Operation failed!";
end
A semicolon after an end delimiter is not an error but
is treated as a null statement.
Names in statements and throughout an EGL source file are case-
insensitive;
record1 is
identical to
RECORD1, for example, and both
add and
ADD refer
to the same keyword. Exceptions are mentioned as appropriate, as in the following
cases--
- The name of a generatable part such as a program must be the same as the
name of file, and the name is case sensitive.
- The name of an EGL package is case sensitive.
- When you use the source tab in Page Designer, you can manually bind components
in a JSP file (specifically, in a JavaServer Faces file) to data areas in
a PageHandler. Although EGL is not case sensitive, EGL variable names referenced
in the JSP file must have the same case as the EGL variable declaration; and
you fail to maintain an exact match, a JavaServer Faces error occurs. It is
recommended that you avoid changing the case of an EGL variable after you
bind that variable to a JSP field.
System words are a set of words that provide special functionality:
A line in a function can have more than one statement. It is recommended
that you include no more than one statement per line, however, because you
can use the EGL Debugger to set a breakpoint only at the first statement on
a line.
See also Comments.