Section 14.22: a4gl_get_info() Up Chapter 14: Extensions Section 14.24: Dynamic Form Fields 

14.23 get_error_details()

An example:
MAIN
   WHENEVER ERROR CALL bibble
   OPEN c1 # not declared - so it should error...
END MAIN

FUNCTION bibble()
   DEFINE lv_line INTEGER
   DEFINE lv_mod CHAR(255)
   DEFINE lv_msg CHAR(255)
   DEFINE lv_stat INTEGER
   CALL aclfgl_get_error_details()
     RETURNING lv_line,lv_mod,lv_stat,lv_msg
   DISPLAY "There was an error : "
   DISPLAY "in module: ", lv_mod CLIPPED," line ",lv_line
   DISPLAY "status = ",lv_stat," sqlca.sqlcode=", sqlca.sqlcode
   DISPLAY "message : ",lv_msg CLIPPED
END FUNCTION
 Section 14.22: a4gl_get_info() Up Chapter 14: Extensions Section 14.24: Dynamic Form Fields