Page 1 of 1

How to Abort a Job When Warning occurs for a Parameter

Posted: Thu Dec 23, 2004 11:57 pm
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

Posted: Fri Dec 24, 2004 12:10 am
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,

Posted: Fri Dec 24, 2004 1:24 am
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,

Posted: Fri Dec 24, 2004 9:43 am
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.

Posted: Sun Dec 26, 2004 8:50 pm
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.

Posted: Sun Dec 26, 2004 9:42 pm
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.

Posted: Mon Dec 27, 2004 8:08 am
by chulett
Thanks Ray. :wink:

Posted: Mon Dec 27, 2004 12:09 pm
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.