Example: orders.4gl (MAIN block)

This MAIN block of the orders.4gl module is the entry point of the progam execution.

MAIN block in orders.4gl:
  1 MAIN
  2   DEFER INTERRUPT
  3 
  4   CONNECT TO "custdemo"
  5 
  6   OPEN FORM f1 FROM "orders"
  7   DISPLAY FORM f1
  8 
  9   CALL orditems_dialog()
 10 
 11 END MAIN
Note:
  • Line 2 declares the we defer the interruption events. If the program receives the SIGINT signal, it will continue.
  • Line4 establishes an SQL connection to the database identified by the custdemo data source. The SQL connection parameters are defined in the fglprofile file.
  • Line 6 loads the main form of the program, defined in the orders.per file compiled as orders.42f.
  • Line 7 displays the loaded form into the current window, which is the default SCREEN window.
  • Line 9 gives the control to the orditems_dialog function.