EGL statements
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
- Page handler
- Record
- Data uable
- 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 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!"; endA semicolon after an end delimiter is not an error but is treated as a null statement.
Names in statements and throughout EGL are case-insensitive; record1 is identical to RECORD1, for example, and both add and ADD refer to the same keyword.
Note: 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 page handler. 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 system function runs code and may return a value; for example:
- sysLib.minimum(arg1, arg2) returns the minimum of two numbers
- strLib.strLen(arg1) returns the length of a character string
The qualifier (mathLibstrLib or sysLib) is necessary only if your program has a function of the same name.
- A system variable provides a value without invoking a function; for example:
- sysVar.errorCode contains a status code after your program accesses a file and in other situations
- sysVar.sqlcode contains a status code after your program accesses a relational database
The qualifiersysVar is necessary only if your program has a variable of the same name.
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.
Related concepts
EGL projects, packages, and files
Function part
Parts
Related reference
add
Assignments
call
case
close
Comments
Data initialization
delete
EGL reserved words
execute
Function invocations
get
get next
get previous
if, else
Keywords in alphabetical order
Logical expressions
Numeric expressions
open
prepare
replace
set
Text expressions
System words in alphabetical order
sysVar.terminalID
while