How to Abort a Job When Warning occurs for a Parameter

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
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

How to Abort a Job When Warning occurs for a Parameter

Post by bapajju »

Hi,

I have job that has a parameter called TYPE and this parameter can have values like A or B. The requirement is like:

if I run with TYPE=A and I get any warnig message then I want to immediately abort the job, but if I run with TYPE=B and any warnig occurs then it should give standard datastage log.

Kindly let me know how to chieve this.

Thanks in advance
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
you could try to check in a stage variable or link for warnings and abort if the job type is A.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Roy,

Thanks for your reply. But could you please let me know how can I check for warnings in a stage variable. It will be very kind of you.
roy wrote:Hi,
you could try to check in a stage variable or link for warnings and abort if the job type is A.

IHTH,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't think you can do this from inside the job. :? What I'd look into doing is running the job from some custom Job Control code where you set the parameter values yourself and then start the job. Before that, you could check the value of your TYPE parameter and set the Warning Limit for the job based on it - if it is 'A' then set the limit to 1 and it will abort the job after the first warning is logged. Let me look up the syntax...

Use DSSetJobLimit with a Limit Type of DSJ.LIMITWARN set to 1. Otherwise, set the warning limit to 0 to mean unlimited.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Thanks Chulett. I think this should be the solution i.e. controlling the job from out side. It will be very nice of you if you could publish the Syntax for the same.

Thanks
Bapajju
chulett wrote:I don't think you can do this from inside the job. :? What I'd look into doing is running the job from some custom Job Control code where you set the parameter values yourself and then start the job. Before that, you could check the value of your TYPE parameter and set the Warning Limit for the job based on it - if it is 'A' then set the limit to 1 and it will abort the job after the first warning is logged. Let me look up the syntax...

Use DSSetJobLimit with a Limit Type of DSJ.LIMITWARN set to 1. Otherwise, set the warning limit to 0 to mean unlimited.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you are running the job from a DataStage Director, select the Limits tab on the Job Run Options dialog, and change the setting to abort job after 1 warning (rather than the default 50).

If you are running the job from the command line interface dsjob, then specify the -warn 1 option after the -run option.

If you are running the job from a job control routine, then use the function DSSetJobLimit. You can get the syntax from on-line help.

Code: Select all

ErrCode = DSSetJobLimit(hJob, DSJ.LIMITWARN, 1)
where the job handle variable hJob was assigned in an earlier call to DSAttachJob().

If you want to do it from inside the job, then you can create an additional output from the Transformer stage and send any row that you want to cause an abort along this link, using a constrait expression. While editing the constraint expression, also set the row limit for that link to 1.

Obviously you need to test for TYPE = 'A' in each case.
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 »

Thanks Ray. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Try using a Sequencer job. It is very easy to you the NestedCondition stage to check the value of a parameter, and thereby trigger the execution of different JobActivity stages, both running the same job. The difference is that one JobActivity stage would trigger an abort on the failed condition, and the other would trigger an abort on the failed or warning condition.
Post Reply