Page 1 of 1

Conditional Abort in the job on failure of the condition

Posted: Tue Aug 21, 2007 6:39 am
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

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

Posted: Tue Aug 21, 2007 7:09 am
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. :?

Posted: Tue Aug 21, 2007 1:51 pm
by ray.wurlod
Post your job design and be specific about which sequential file is not being created.

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

Posted: Tue Aug 21, 2007 10:31 pm
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.

Posted: Tue Aug 21, 2007 10:51 pm
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.

Posted: Tue Aug 21, 2007 11:28 pm
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.

Posted: Tue Aug 21, 2007 11:37 pm
by Maveric
"Cleanup on failure" property in Sequential file stage should be set to "Fasle"

Posted: Wed Aug 22, 2007 12:37 am
by gaurav_shukla
Maveric,

I have tried the same solution as suggested by you, but still its not writing to error file.

Posted: Wed Aug 22, 2007 2:09 am
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.