Error handling

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Perwezakh
Premium Member
Premium Member
Posts: 38
Joined: Mon Jun 06, 2005 9:13 am
Location: Chicago, IL

Error handling

Post by Perwezakh »

Hi Guys
As per my requirement I have to dump all error messages, error codes and time for error to a company built centralised error database (which they use to track all errors in their whole system and send emails to respective employees).
I have found there are DSGetJobInfo, DSAttachJob fuction, DSGetLogEntry function, and many functions they provide some informations about errors and warnings.
But the way they described the functions is not very helpful to me or I am not understanding at all.
I just want to get Error message and error code, can any one please tell me which function I should use and what should be real syntex I should use ( Please give me examples).
Thanks in advance
Perwez
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Re: Error handling

Post by kris »

Hi Perwez,

Here are some inputs.
You need to design your jobs in such away that they handle all the cases where you reject the record to somewhere along with the reason why it rejected. That takes you to have all the rules framed in the process and validating your input data on those rules and rejecting the bad records.

Its always not good to skip validating your data and allowing to database and wait until database rejects them and then try to capturing the record and error code. You will do this only if you can not avoid doing it.

But the Good Practice is validate the input data for all the validations with your code and capture them and try not to send records to database which are going to be kicked out.

This needs you to know what are all the validations that you need to do in the prcess and have the code to handle them properly(with bunch of stage variables) and route your data with proper constarints on the links where do you want to wrote them. Any record missing your validations will go and get rejected at database level then you capture that will output link variables (link.REJECTED, link.DBMSCODE, link.SQLSTATE,...etc).

But remember there are limitations and proper usage of those variables.You have lot of information on those here.

You populate all the rejected records with reason and all wherever you want with convinient layout (Files or tables) and let the operations know.

Hope I didn't bore you.....

Kris~
Perwezakh
Premium Member
Premium Member
Posts: 38
Joined: Mon Jun 06, 2005 9:13 am
Location: Chicago, IL

Re: Error handling

Post by Perwezakh »

kris wrote:Hi Perwez,

Here are some inputs.
You need to design your jobs in such away that they handle all the cases where you reject the record to somewhere along with the reason why it rejected. That takes you to have all the rules framed in the process and validating your input data on those rules and rejecting the bad records.

Its always not good to skip validating your data and allowing to database and wait until database rejects them and then try to capturing the record and error code. You will do this only if you can not avoid doing it.

But the Good Practice is validate the input data for all the validations with your code and capture them and try not to send records to database which are going to be kicked out.

This needs you to know what are all the validations that you need to do in the prcess and have the code to handle them properly(with bunch of stage variables) and route your data with proper constarints on the links where do you want to wrote them. Any record missing your validations will go and get rejected at database level then you capture that will output link variables (link.REJECTED, link.DBMSCODE, link.SQLSTATE,...etc).

But remember there are limitations and proper usage of those variables.You have lot of information on those here.

You populate all the rejected records with reason and all wherever you want with convinient layout (Files or tables) and let the operations know.

Hope I didn't bore you.....
Kris~
Hi Kris,
Ofcourse not, you didn't bore me. But I think I didn't explain my requirements well.
Let me give you guys example. Let consider you are running 10 different DataStage jobs. If Every jobs runs fine then every one is happy. But if job1 and job2 failed because of some error and some stage. What I have to here is that I have to catch error log information for each jobs while each job runs. If job run OK then I won't be having any thing in my error captutre file if any job fail I should have error message or error log informations in this file (which can be same information that DataStage might log into log file). Now I have error message in one file and I read this file by another DataStage job and insert into company centralised error handling database.
So now please advice me how I can capture error message of each job in to one file. Please don't forget to give me some example if you suggest to use any DataStage function.
Thanks a lot
Perwez
Post Reply