Example 4: Global variables

File "myglobs.4gl":
GLOBALS
  DEFINE userid CHAR(20)
  DEFINE extime DATETIME YEAR TO SECOND
END GLOBALS
File "mylib.4gl":
GLOBALS "myglobs.4gl"

DEFINE s VARCHAR(100)

FUNCTION myfunc()
  DEFINE i INTEGER
  DISPLAY "User Id = " || userid 
  FOR i=1 TO 10
      LET s = "item #" || i 
  END FOR
END FUNCTION
File "mymain.4gl":
GLOBALS "myglobs.4gl"

MAIN
  LET userid = fgl_getenv("LOGNAME")
  LET extime = CURRENT YEAR TO SECOND
  CALL myfunc()
END MAIN