The CALL statement can be used to invoke a function within a 4GL application. It can be 4GL functions, C functions, or ESQL/C functions. The 4GL functions can be built-in functions or those defined by the programmer.
Programmer-defined 4GL functions can be included within the primary 4GL application file, which contains the MAIN program block, or they can be contained within other .4gl source files and function libraries.
Expression |
The name of the function you want to call |
Argument list |
The optional list of arguments which you want to pass to the called function, it can be empty |
Variable list |
It can be any variable of a simple or a structured data type (an element of an array or a record). It cannot be of a large data type |
Here is an example of calling a programmer-defined function:
MAIN
…
CALL my_function()
…
END MAIN
FUNCTION my_function()
…
END FUNCTION
When 4GL encounters a CALL statement that invokes a programmer defined function, it looks for the FUNCTION program block which corresponds to the function name specified in the CALL statement. A programmer defined function must have a unique name, otherwise 4GL will not be able to define which function to invoke and an error will occur. If a CALL statement contains the RETURNING clause, the invoked function can return values from the function into the calling routine.
The 4GL functions are not case sensitive and can be specified either in lower case or in upper case letters. The C functions are case sensitive; they must be specified in lower case letters.