when using DB2 UDB records are dropped No warnings

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
haimurali
Participant
Posts: 5
Joined: Mon Nov 07, 2005 10:50 pm

when using DB2 UDB records are dropped No warnings

Post by haimurali »

I am using two jobs to load two DB2 tables A and B.
Table A's primary key is forein key in Table B.

After loading A, while loading B I am not getting any warnings when there is a referential integrity viloation. The records were dropped/not loaded in B. The job was successful WITHOUT warnings.

Is there a setting I need to do get the warnings in case of Referential integrity viloation when using DB2 UDB stage.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Put a link to a reject sequential file in the transform stage where you are loading to DB/2. Use the contstraints to push links out to the reject (click on the "..." button to get output variables) as well as to choose which database information to write.
haimurali
Participant
Posts: 5
Joined: Mon Nov 07, 2005 10:50 pm

Post by haimurali »

The requirement is that the DB2 UDB Stage has to cause the job to Abort in case of referential integrity viloation(due to SQL error from the database) while inserting records.

Currently it is just dropping records that have referential integrity violation and job completes successfully.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Murali

I don't think that there is a setting to abort jobs in case of referential integrity violation. You have implement this logic in your job by doing a lookup to the parent table to find out whether record exist and then insert. You can then take necessary action whether to make the job abort or not.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It is always better not to abort the flows.
But you can do this by adding a transformer in reject link and you can provide the constraint as abort after 1 row. But need to make sure that all the rejects are due this reason.
Or you can do a post checking with the job log, for the specific SQL error code and issue a warning or can notify.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

haimurali wrote:Currently it is just dropping records that have referential integrity violation and job completes successfully.
I'd be suprised if it is actually completing "successfully". It should be throwing warnings into the log and have a status of "Finished (see log)" when done. It would abort once the number of warnings exceeds your threshold, the default of which is 50, so I would think you had fewer than that. This time. :wink:

So, different options. Run the job with a much lower warning threshold. Add a reject link as Arnd suggested to explicitly capture them. You could even set it to 'Abort after X rows' in the constraint such that 1 was all it took. If you need to capture all of them and then abort at the end, you'll need to get tricky in the after job part of town.

Also note that some stages have a checkbox for 'Treat warnings as fatal' which is yet another way to handle this.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

chulett wrote: I'd be suprised if it is actually completing "successfully". It should be throwing warnings into the log
Craig, this is possible. I have had this issue earlier and honestly speaking if you see the logs, you see all GREENS.

haimurali
What you can do is that have this job abort in sequence itself. You can go by the abortion of the process at the job level or Sequence level.
You can select maxtimestamp on the rows and compare it with the currenttimestamp. I hope it helps.
Good luck.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

OR you can update your process control tables if you have one. Those tables are always handy. And based out of that table you can have your sequence be aborted.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If that's the case, it must be a DB2 stage/database thing as that's certainly not possible with Oracle and OCI.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

DSguru2B wrote:
chulett wrote: I'd be suprised if it is actually completing "successfully". It should be throwing warnings into the log
Craig, this is possible. I have had this issue earlier and honestly speaking if you see the logs, you see all GREENS.

haimurali
What you can do is that have this job abort in sequence itself. You can go by the abortion of the process at the job level or Sequence level.
You can select maxtimestamp on the rows and compare it with the currenttimestamp. I hope it helps.
Good luck.
Hi Can you explain how Timestamp comparison can be useful for Referential Integrity violation.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What I am trying to convey is that whatever rejects he gets can be captured in a process control table. He can select the maxtimestamp on that table and compare it with( not Currenttimestamp :oops: but ) with the job start time. If it is greater than that then, he can pass the result to a job abort script or the sequence that is being used to control that job and have it report it.
I am not sure about this but some changes can be made to the message handler, but i guess its for EE/Px only.

I am just advising another way of reporting the violation of referential integrity.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
haimurali
Participant
Posts: 5
Joined: Mon Nov 07, 2005 10:50 pm

Post by haimurali »

Chulett, Thank you all for your suggestion.

I was surprised to know that there is no way we can transulate an SQL error (such as referential integrity, data integrity, unique constraints.. etc )to a job to Abort.

Many ETL tools like Informatica and also DataStage PX too Abort jobs due to an SQL Error.
Last edited by haimurali on Fri Mar 17, 2006 9:51 am, edited 2 times in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A job sequence in which all conditions are handled will finish successfully. The very act of coding triggers to handle failures asserts that you want to specify how they're to be handled. You could include a Routine actvity calling UtilityWarningToLog if you want to force a warning message to occur, or (in 7.5 and later) check the job sequence compilation option to log a warning if an activity fails.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

haimurali wrote:I was surprised to know that there is no way we can transulate an SQL error (such as referential integrity, data integrity, unique constraints.. etc ) to a job to Abort.
This is not at all true. You have a specific issue with DB2 and whatever stage you are using. Perhaps a setting in the database needs to be changed? I don't know DB2 so others more familiar with it should chime in as I'm sure this is solvable...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply