is there anyway to return the syntax that triggers the error? I know that the lineno() and program() can be used to track down the program and line but then you have to open these to locate the error.
I am probably being a bit lazy but it would be very useful.
You need to write a procedure calledd ErrorTrap or similar
ON ERROR DO ErrorTrap WITH ;
[tab]SYS(16),;
[tab]LINENO(),;
[tab]ERROR(),;
[tab]MESSAGE(1),;
[tab]MESSAGE()
*************************
* Procedure: ERRORTRAP
* Syntax: DO ERRORTRAP
* ***********************
PROC ErrorTrap
PARAMETERS lcProgramName,;
[tab]lnLineNumber,;
[tab]lnError,;
[tab]lcErrorMessage,;
[tab]lcErrorType
* Code
ENDPROC
You can add all sorts of other information into the procedure, such as tablename, record no, EOF(), SYS(0), SYS(5), SYS(2003), RELATION(), FILTER() etc, and produce a concatenated mini report which can the be appended into a memo field in a table called ERRORLOG or similar.
At the end of the procedure, DO FORM ERRORLOG, which will then allow you or user to view the error and then CONTINUE, RETRY, QUIT etc.
Right diagnosis: you already all know !
on error do myError with program(), lineno()
...
proc myError
...here you may do various activity:
- save error in error table
- call it
- for certain error code do appropriate activity
... and finally return/retry.
As it is specific for each case,
you must it write oneself...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.