How can I force an error on a negative DB2 Return Code?

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you run the reject link from the Transformer stage (on which you can capture DBMS error code using output link variable) you could use an output row limiter set to 1. That would cause the job to abort. It's not really an approach I advocate, but if that's what you want to do...
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mikey
Participant
Posts: 32
Joined: Fri Jan 15, 2010 3:21 pm

Post by Mikey »

That solution is an option, but one that would require a Transformer Stage after every ODBC (DB2 select) Stage. This would be a lot of rework on our existing jobs, but I do appreciate your insight.

I need to confirm this, but I believe a SQL -911 on our ODBC connection to our DB2 mainframe issues a fatal error, but issues a warning error on our DB2 UDB database. This leads me to believe that some parameter setting can be set to always force a fatal error when a negative SQL return code is encountered. Don't know where to look for that parameter...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, it requires a Transformer stage before each ODBC stage. I imagine that you quite often have one of these, to drive the link into the ODBC stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mikey
Participant
Posts: 32
Joined: Fri Jan 15, 2010 3:21 pm

Post by Mikey »

The ODBC stages are typically the first stage in our jobs; these stages are selecting data from DB2 for the remaining stages to manipulate, etc. Adding a Transformer before each of these stages to handle a negative SQL return code seems like a lot of work.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That wasn't what was being suggested, the assumption it was made under was that the ODBC stages were a target in your job. I assume. :?
Last edited by chulett on Fri Jul 30, 2010 7:12 am, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mikey
Participant
Posts: 32
Joined: Fri Jan 15, 2010 3:21 pm

Post by Mikey »

Any other suggestions?

I can't believe this is an issue in the first place...why would DataStage treat some negative return codes as fatal and others as a warning? This should have been my original question posted.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

In version 7.x, we can demote warning messages to Informational messages. Not sure if there is an option in version 8.x to add rules to the message handler in the director to promote the warning messages as a Fatal error message.
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There isn't, in any version, a means to promote message severity. What you could do is to create an after-job subroutine to check the log for this particular message and generate a fatal error at that point, though any data processed by the job will remain processed.
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 »

kris007 wrote:In version 7.x, we can demote warning messages to Informational messages. Not sure if there is an option in version 8.x to add rules to the message handler in the director to promote the warning messages as a Fatal error message.
Not for Server jobs.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Just guessing, but since this is Server, but here's a suggesetion that might work "IF" the -911 is something that can be detected on an "input" action (update, insert, or custom SQL from an input link).

Use Ray's design suggestions above in a bogus first stage and link.....Create some sort of dummy flat file with one record that you read at the start of the Job and pass thru a transformer on the way to your ODBC Stage....then from the Transformer to the ODBC stage, create two links.......one that performs some sort of SQL that will hopefully generate the error in concern, and he other to "react" to that error.....

As Ray and others noted, inside the second link, you can test on the return code of the first link "after" that link fires [check out the link variables that are available to you in the Derivation]........if it can generate the condition you are looking for, you will be able to test it and then react in this other link and do some other processing such as abort the job, write out a file somewhere with a message, etc.

The "true" output link of your ODBC stage will not start until all the processing of the input links is complete.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Mikey
Participant
Posts: 32
Joined: Fri Jan 15, 2010 3:21 pm

Post by Mikey »

I appreciate the creative work-around solution, but it does not answer my question, "why would DataStage treat some negative SQL return codes as fatal and others as a warning?"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to go back to the vendor for that answer, I'm afraid.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Yeah..that one's a tough call. Hard to say...too many layers along the way.... Have you tried the DB2 API Stage under the exact same circumstances? Perhaps it reacts differently.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply