Conditional Abort in the job on failure of the condition

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
gaurav_shukla
Participant
Posts: 12
Joined: Wed Jun 13, 2007 2:12 am

Conditional Abort in the job on failure of the condition

Post by gaurav_shukla »

I have a job which needs to abort, when a particular condition fails and write to sequential Error File with message that indicate cause of error.

For which I have used "Abort After Rows = 1" functionality in Transformer, but the thing is when that specific conditon fails then job does not create sequential file and it directly aborts.

If anybody can provide me the solution for this, i would be thankful.

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

Re: Conditional Abort in the job on failure of the condition

Post by chulett »

gaurav_shukla wrote:the thing is when that specific conditon fails then job does not create sequential file and it directly aborts.
What 'specific condition'? What abort? Not a whole heck of a lot to go on. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Post your job design and be specific about which sequential file is not being created.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gaurav_shukla
Participant
Posts: 12
Joined: Wed Jun 13, 2007 2:12 am

Re: Conditional Abort in the job on failure of the condition

Post by gaurav_shukla »

I have Datastage job and which verifies Header Record in a particular file, it checks that first column of header file should be 'A'.

If first column record is not 'A' then it should write error message(Invalid Header) in Error File(Sequential File) and after that the Datastage job should abort.

The Structure of the job is given below:

Database Extract Error File
| |
| |
| |
Seq. file ---> Lookup Stage ---->Transformer (Validation) ------> Transformer (Abort) -------------> Copy stage

First it should read header file from input stage then lookup for some more validation (like date of creating header file) then transformer to check 'A' in first column and same validation for other column as well,
in this i have constraint which diverts record in case of validation failure to next transformer and seq. file, after that it will abort the job in next transformer and then a dummy copy job. If no validation fails then datastage job finish succesfully at first transformer.

This design works good except in case of validation failure, it directly aborts without writing to this error file and no file is created.\

Hope this information help.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Database Extract Error File
| |
| |
| |
Seq. file ---> Lookup Stage ---->Transformer (Validation) ------> Transformer (File create) -------------> Transformer(Abort) -------------> Copy stage

Link ordering in the first transformer should be seeq link and then the link to the other transformer. Try this and see.
gaurav_shukla
Participant
Posts: 12
Joined: Wed Jun 13, 2007 2:12 am

Post by gaurav_shukla »

I have tried with Link ordering as well but its still not creating file.
Is this something to do with Configuration file ( 1 node 0r 4 Node) or something to do with partitioning or Execution mode (Sequential or Parallel).

If anybody have diffrent desgin to achive such functionality please share with me.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

"Cleanup on failure" property in Sequential file stage should be set to "Fasle"
gaurav_shukla
Participant
Posts: 12
Joined: Wed Jun 13, 2007 2:12 am

Post by gaurav_shukla »

Maveric,

I have tried the same solution as suggested by you, but still its not writing to error file.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

One way of doing this will be to use an After Job abort routine . There are a couple of advantages that i see
You will get all the rejected data that way , that failed the condition.
Have a constraint on your XFM to output these "exception" records and in the abort routine use the record count on the link to decide if you want to abort or not.
Post Reply