call

The call command calls a function in the program.

Syntax

call function-name ( [ expression [,...] ] )
  1. function-name is the name of the function to call.
  2. expression is a combination of variables, constants and operators.

Usage

The call command invokes a function of the program and returns the control to the debugger.

Expressions such as program variables can be passed as parameters to the function.

The return values of the function are printed as a comma-separated list delimited by curly brackets.

Example

MAIN
    CALL func1()
END MAIN

FUNCTION func1() RETURNS ()
    DEFINE x INT, s STRING
    CALL func2() RETURNING x, s
END FUNCTION

FUNCTION func2() RETURNS (INT,STRING)
    RETURN 999, "xxxxxx"
END FUNCTION
$ fglcomp -M prog.4gl && fglrun -d prog.42m

(fgldb) break main
Breakpoint 1 at 0x00000000: file prog.4gl, line 2.

(fgldb) run
Breakpoint 1, main() at prog.4gl:2
   1     MAIN
-> 2         CALL func1()
   3     END MAIN
   4
   5     FUNCTION func1() RETURNS ()

(fgldb) call func2()
$1 =  { 999 , "xxxxxx" }