Problem –
For any job we want to log success or failure at the end of the job in our job log tables.
Solution -
We can use tWarn and tDie to forcefully trigger an exception which can be handled by tlogcatcher.
See example below – we are reading from flat file and inserting into target flat file.
Now “OnSubJobOK” of our main job – we say tWarn with code as 5 (you can use any code) and “OnSubJobFailure” we say tDie – with code as 4 (you can use any code but not the one used in tWarn).
Now when your job completes successfully tWarn will be called and it will throw an exception which will be catched by tlogcatcher with code as 5. Similarly if job fails tDie will be triggered and it will throw an exception which will be catched by tlogcatcher with code as 4.
Now in output of tlogcatcher you can verify decide whether the job was success or failure based on this code and take necessary actions as possible
No comments:
Post a Comment