Currently investigating migrating from mvBase to Unidata and would like to know if User Defined Functions are supported as I cannot see this in the documentation I have downloaded?
e.g I have DATABASIC program with something like
A = @FUNCTION_NAME(VAR1)
Yes, Unidata supports user defined functions.
To create a function in Unidata, use a line like this on line 1 of the code file:
Inside the function, use the RETURN statement to return a result:
To call it, you have to indicate that you're going to use it with the DEFFUN statement in the program that will use the function:
I usually put my DEFFUN statements near the top of the program, right after any $INCLUDEs. (The parameter names don't have to match between the FUNCTION and DEFFUN lines, but I don't know of any reason to purposefully make them different.)
After that setup, you can call the function by using its name in an expression:
After that statement, TOTAL will have a value of 25.
I've never seen a function called with the @FUNCTION_NAME syntax in Unidata.