Example 3: PRIVATE and PUBLIC module variables

This example declares public and private module variables. Public variables can be shared with other modules.

File "mydebug.4gl":
PUBLIC DEFINE debug_level VARCHAR(100)
PUBLIC DEFINE debug_logfile VARCHAR(100)

PRIVATE DEFINE message_count INTEGER

FUNCTION debug_msg(m)
  DEFINE m STRING
  IF debug_level THEN
     -- Write message to debug_logfile
     ...
  END IF
END FUNCTION
File "mymain.4gl":
IMPORT FGL "mydebug.4gl"

MAIN
  LET mylog.debug_level = 4
  CALL debug_msg("Some debug info...")
END MAIN