Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
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
Can you please explain your question ? , you want to fail your script at the end of execution?
Am i correct ?
Hi Agnivesh,
Yes, that is right.
Thanks
apply any unknown charecter at the last of the script. It will fail
I have used simple a load statement
X:
LOAD A,
B,
C
FROM
(
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 .
Or
If you want other thingh then tell me
Hi
Try Using Errormode=2
Hope that helps you.
Regards
Av7eN
Hi Nirmal,
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);
END IF
;
END SUB
;
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();
LoadingLog:
LOAD
'$(vStopLogTime)' AS [StopTime],
'$(vStatus)' AS [Status],
'$(vMessage)' AS [ErrorMessage]
AUTOGENERATE(1);
END SUB
;
Hi,
Let me try that.
Thanks
Thanks everyone for your valuable inputs.
I have used ScriptErrorCount and alert service to notify admin in case of failure.