What are the ground rules for using LOCALs and STATICs?
LOCALs and STATICs must be the first statements in a function,
except possibly for the PARAMETERS statement. They may be
declared with initial values (e.g. LOCAL a := 1), but STATICs may
not be initialized with a value that is unknown to the compiler
(e.g. STATIC b := myfunc()--where myfunc is the name of your
user-defined function--is invalid). The initialization is
performed every time the function is called (in the case of
LOCALs) or once at the beginning of the program (in the case of
STATICs).
If you want to use a file-wide STATIC variable to share information
among functions within the same source module, that module must be
compiled with the /n switch, and the STATIC declarations must
precede the first FUNCTION or PROCEDURE.