Error Handling in Datastage

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
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Error Handling in Datastage

Post by srinagesh »

Hi !

I am developing a datastage job which will read from Flat files and database tables, do lookups and then populate the target.

The logic and the Reject row handling (lookup not found) is already in place.

I was wondering if I could capture possible errors like File not available, File cannot be read, data type mismatch, Constraint violated, database connection errors etc.

I know that we can do that in the job sequencing bit, after the Job aborts/completes with the error, by reading into Datastage logs.

What i was wondering is whether we can handle these errors in the Job itself.

Regards
Nagesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a before-job or before-stage subroutine you can use appropriate UNIX commands such as test to determine existence, readability, etc.
The only way to detect data type mismatch is to read everything as VarChar and create your own tests. Data type mismatch is logged, so you could pick this up in an after-stage or after-job subroutine that interrogates the log.
Constraint violated can be handled by a [Reject] link. This traps any errors returned from the database or ODBC driver; you can use link variables such as SQLSTATE, DBMSCODE and LASTERR to get specific diagnostic information.
Database connection errors are probably the hardest to do in a job; much easier to do in the sequence; validate the job then, if this is OK, the database connection is necessarily OK.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply