Function parameters

Functions can take parameters, to specialize their behavior.

The FUNCTION block defines the body and the type (i.e. declaration) of a function. The function declaration specifies the name of the function and the identifiers of its formal arguments (if any).

The data type of each formal argument of the function must be specified by a DEFINE statement that immediately follows the argument list.
FUNCTION check_address(zipcode, street, city)
  DEFINE zipcode CHAR(5),
         street VARCHAR(100),
         city VARCHAR(50)
  DEFINE found BOOLEAN -- local function variable
  ...
END FUNCTION
The type of the function parameters can also be specified inside the parentheses, for better code readability:
FUNCTION check_address(zipcode CHAR(5), street VARCHAR(100), city VARCHAR(50))
  DEFINE found BOOLEAN -- local function variable
  ...
END FUNCTION

Like other identifiers, function names are case-insensitive. However, always consider using the same naming convention when defining and invoking functions.

Note: If the function name is also the name of a built-in function, an error occurs at link time, even if the program does not reference the built-in function.
If no argument is needed in a function call, an empty argument list must still be supplied, enclosed between the parentheses:
FUNCTION begin_work()
   ...
END FUNCTION