Is there any way to fail a script only at then end of execution?
We have a script which should not fail until it runs the entire script so we set errormode=0 but in case of failure we have to open the log and check line by line. Please suggest a way to track the error and display it at the end of the log.
Thanks in advance
I have used simple a load statement
DROP TABLE N;
when this script will run then it will give the error for table not fount and this will also captured in the log file , i have attached the log file screenshot .
If you want other thingh then tell me
I would propose following solution
After each statement in load script you can check error an store them in table. As a result you will have loaded data and table with errors.
For example define following procedure
SUB checkForError (vScriptError, vScriptErrorDetails)
//saving error code if error occurred
IF vScriptError > 0 THEN
LET vErrorCode = vScriptError ;
LET vErrorMessage = replace(vScriptErrorDetails, chr(39), '"'); //if errormessage looks like " '<filename>' file not found" we should replase (') with (")
CALL writeLog (vErrorCode, vErrorMessage);
Call this procedure after each operator in your script
CALL checkForError(ScriptError, ScriptErrorDetails);
Don't forget to prepare procedure for writing log in table
SUB writeLog (vStatus, vMessage)
LET vStopLogTime = now();
'$(vStopLogTime)' AS [StopTime],
'$(vStatus)' AS [Status],
'$(vMessage)' AS [ErrorMessage]