Page 1 of 1

Not able to prevent generation of empty CSV file

Posted: Wed Sep 05, 2007 7:55 am
by kasgang
Hi Gurus

I am generating a CSV file from within a job with sequential file stage.However , whenever there is no data at the source side , it is generating a blank CSV file. Is there any way I can prevent this or any workaround .

Posted: Wed Sep 05, 2007 8:07 am
by chulett
Prevent? No. If it really bothers you, you can build an after-job subroutine to detect the empty file and delete it if you like.

Re: Not able to prevent generation of empty CSV file

Posted: Wed Sep 05, 2007 8:14 am
by gateleys
kasgang wrote: I am generating a CSV file from within a job with sequential file stage.However , whenever there is no data at the source side , it is generating a blank CSV file.
Isn't it supposed to?? :roll:
kasgang wrote: Is there any way I can prevent this or any workaround .
Why would you want to prevent this?

Posted: Wed Sep 05, 2007 8:39 am
by roy
Hi,
By definition an empty fie should contain nothing if it is really empty :!:
This is done as part of the overwrite operation on the previos file.

You can try to delete any existing file, then only run the job if there are rows to process.
Or you can delete the file after verifying no rows were written to it.
IHTH,

Posted: Wed Sep 05, 2007 8:48 am
by chulett
roy wrote:By definition an empty fie should contain nothing if it is really empty :!:
Or it could contain a single header record. That's why, IMHO, you should check the LinkRowCount and not the file size as that will 'always' work for you.

Posted: Wed Sep 05, 2007 1:26 pm
by roy
OK I ment DATA wise Craig, probably that exclamation mark was uncalled for :wink:
Craig if you were refering to a file header record that contains some general and or validation data like the number of rows that the file should contain then that is also data.

Obviously the way to determine number of rows is subject to the process logic and should reflect a proper method to reflect existance of or lack of rows :)

Posted: Thu Sep 06, 2007 6:03 am
by kasgang
Hi Gurus

Thanks for the inputs. By empty files I meant , file with header rows only . The way I am doing it now , is checking the LinkRowCount and writing to another file the filenames with LinkRowCount=0.
Then I am deleting the empty CSV files referring to this file.

Just wanted to know if there is anythig better that way to do the same.

Posted: Thu Sep 06, 2007 7:39 am
by chulett
I guess the only 'better' way would be to stop worrying about it and just leave them alone. :wink:

use folder stage

Posted: Mon Sep 10, 2007 3:32 am
by parag.s.27
Make use of Folder stage as the target stage instead of the sequential file stage and your requirement will be achieved easily. we have done the same things successfully.