Page 1 of 1

Fail a job when file pattern not found

Posted: Wed Aug 11, 2010 7:58 am
by UPS
I have a job the that uses file pattern to pick up all the files in a directory that has a specific file pattern.I want the job to fail when there is no file with that pattern but the job just shows a warning that there is no file and does not fail. Please let me know how I can make the job to fail.Thanks in advance

Posted: Wed Aug 11, 2010 8:26 am
by kumar_s
You can promote that particular warning to Fatal Error message using Message handler.
Or you can pre check the number or rows with the given file mask in unix and not to run the job at all.

Posted: Wed Aug 11, 2010 8:42 am
by kris007
How many Sequential File Stages do you have in your job? Are you trying to read other files with different wild cards or names in the same job? I have seen this happen when there were multiple Sequential file stages within the same job and one of the file was not present in the directory the job was expecting to be.

Posted: Wed Aug 11, 2010 8:45 am
by Sainath.Srinivasan
How about a pre-job exec sh with the ls command ?

Posted: Wed Aug 11, 2010 12:08 pm
by UPS
kumar_s wrote:You can promote that particular warning to Fatal Error message using Message handler.
Or you can pre check the number or rows with the given file mask in unix and not to run the job at all. ...
Thank you for the response...I understand what u are saying but I want to know if this can be handled using some kind of option in sequencial file or in datastage instead of using unix to do that.Please let me know

Posted: Wed Aug 11, 2010 12:12 pm
by UPS
kris007 wrote:How many Sequential File Stages do you have in your job? Are you trying to read other files with different wild cards or names in the same job? I have seen this happen when there were multiple Sequential file stages within the same job and one of the file was not present in the directory the job was expecting to be.
Thank you for the response I am trying to read files using wild cards. I have only one sequencial file stage in the job .Let me know

Posted: Wed Aug 11, 2010 7:33 pm
by ray.wurlod
A before job subroutine that performs a check is the ideal way to solve this issue.