Page 1 of 2

How to abort job based on constraint

Posted: Thu Dec 07, 2006 7:38 pm
by chalasaniamith
I know its not a good practise to abort job.
But based on requirment i need to abort job based on a condition in Transformer.Is there any way to do it.I searched in form i didnt get the needed information So any one can help on this ?

Posted: Thu Dec 07, 2006 7:51 pm
by thebird
You can always use the Abort After Rows option in the Transformer to achieve this. The only catch being that you cannot pass a parameter to this option.

If you can shed some more light on your requirement and the constarint given, someone can suggest a solution.

Aneesh

Posted: Thu Dec 07, 2006 7:54 pm
by chalasaniamith
thnaks i will try this one.If you dont pass the parameter does the job abort? that what your saying right?

Posted: Thu Dec 07, 2006 7:58 pm
by ray.wurlod
It's impossible not to pass a parameter. If you don't give it an explicit value it will take its default value. If its default value is illegal (for example "" for a date parameter), the job won't even start.

Posted: Thu Dec 07, 2006 7:59 pm
by thebird
chalasaniamith wrote:If you dont pass the parameter does the job abort? that what your saying right?
If you want the job to abort after encountering 5 rows that does not satisfy the constraint - then you would have to hard code 5 in the Abort After Rows option.

What I meant is that you cannot pass 5 as a parameter to that option.

Hope this helped.

Aneesh

Posted: Thu Dec 07, 2006 8:00 pm
by chalasaniamith
thats true we have to give default value to the parameter.Otherwise it wont be compiled.And if we gave default value its not going to work.

Posted: Thu Dec 07, 2006 8:02 pm
by thebird
chalasaniamith wrote:thats true we have to give default value to the parameter.Otherwise it wont be compiled.And if we gave default value its not going to work.
You cannot type in anything other than numbers in the tab for the Abort After Rows. So there is no way you can pass a parameter to this.

Posted: Thu Dec 07, 2006 8:14 pm
by DSguru2B
What about UtilityAbortToLog. That will work.

Posted: Thu Dec 07, 2006 8:16 pm
by chalasaniamith
did u used it any time before..i just want make sure :)

Posted: Thu Dec 07, 2006 8:30 pm
by DSguru2B
Used it in a server job. Can test it on px tomorrow and let you know. It really wont bite, you can try it out for yourself. Fix up a small test job and test it out.

Posted: Thu Dec 07, 2006 8:34 pm
by narasimha
DSguru2B wrote:What about UtilityAbortToLog. That will work.
I guess this could be possible, give it a try

Code: Select all

If PAR_NAME =1 then Incolumn.ColumnA else UtilityAbortToLog('Job Aborted')
Where PAR_NAME is the Parameter Name and 1 is Parameter Value

Play with the parameters.

Did I understand your question right?

Posted: Thu Dec 07, 2006 9:27 pm
by thebird
Since UtilityAbortToLog is written as a transform function, it can not be used in parallel jobs unless a BASIC Transformer stage is used...

Aneesh

Posted: Thu Dec 07, 2006 9:34 pm
by thebird
If you need to pass the number of rows as the parameter, then the best bet will be to build a Custom Stage using the Abort operator.

I haven't really used it in a live job, but have played with it quite successfully.

Aneesh

Posted: Fri Dec 08, 2006 9:29 am
by DSguru2B
I take my words back. UtilityAbortToLog wont work inside the px transformer. The only other work around that i can think of at the moment is writing an after job subroutine and check for number of rows in that particular link. If its more than what you want, you can call DSLogFatal() routine or even UtilityAbortToLog from there.

Posted: Fri Dec 08, 2006 11:13 am
by narasimha
thebird wrote:Since UtilityAbortToLog is written as a transform function, it can not be used in parallel jobs unless a BASIC Transformer stage is used...

Aneesh
Good to know that!