Forcing a job to abort

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
RSchibi
Participant
Posts: 8
Joined: Mon Apr 19, 2004 6:13 am

Forcing a job to abort

Post by RSchibi »

Is there a good way to force a job to abort? I am doing balancing where the final result has to be zero. I have a field called total_difference which is a decimal (15,2). If it's zero, I set a field called abort_sw to 'C' for continue, else I set it to spaces. Abort_sw is a 1 char field.

I found that if I reference the abort_sw in a SWITCH Stage, the job will abort if it's spaces & doesn't abort if it's 'C'. This was found by accident. We are novices here & I'm not confident this will always work.

Thanks for any help.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I always advocate never allowing jobs to abort.

That way the controlling job can remain in control.

If there are problems these can be recorded, in the job log or elsewhere, and detected by the controlling job. Because the controlling job is still in control, it can take any required remedial action and notification action.

For example, in your case, the job could write the balance into a text file, and the controller could use code (or a Command activity, if a sequence) to determine the contents of that file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

If you still want to abort the job then set a constraint in the transformer based on abort_sw and set 'Abort after Rows' in the constraint and that will make the job abort.

HTH
--Rich

Think about what you are thinking because as a man thinks so does he become
--Joyce Meyer
RSchibi
Participant
Posts: 8
Joined: Mon Apr 19, 2004 6:13 am

Post by RSchibi »

Thank you for your suggestions. I also found that I can do it from the switch. I check for case = C (continue) but not case 'A' (abort). Then set the 'If not found' option to FAIL.
I only have one record at this point & it will be either 'C' or 'A'.

Thanks again for your help.
RSchibi
Participant
Posts: 8
Joined: Mon Apr 19, 2004 6:13 am

Post by RSchibi »

Rich - I decided to try your suggestion on using the transformer to cause an abort & it seems to work. I couldn't find any documentation on the 'abort after rows' option, but I think it evaluates the constraint & if it's TRUE, the job will abort after the number of rows where the condition is met.

Instead of using an abort_sw, I check for my TOTAL_DIFFERENCE <> 0.
I set the 'abort after rows' to 1 as I will only have one row.

Please let me know if my thinking is correct.

Thanks!
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

For the first part of your question open the transformer and click the Help button. Click on 'Abort after Rows' property on the Help screen it will pop up necessary documentation that you need. Here is the documentation for Abort after Rows

Code: Select all

Enter the number of rows that can come down this link before the job is aborted. If you specify no number, then there is no limit.
For the second part the data flows downstream when the condition in the constraint is satisfied. In your case it is TOTAL_DIFFERENCE <> 0. If you are sure that only one record would come through then go ahead and set Abort after Rows property to 1. Your thinking is right if this is the case.

HTH
--Rich

Think about what you are thinking because as a man thinks so does he become
--Joyce Meyer
RSchibi
Participant
Posts: 8
Joined: Mon Apr 19, 2004 6:13 am

Post by RSchibi »

Rich - Thank you for your help & also the documentation.
Post Reply