Deletion of output file
Moderators: chulett, rschirm, roy
Deletion of output file
Hi,
I have a Job writing data to four .csv files (in the Sequential file stages) at the end. I do have constraints defined for these satges.
Even though there's no data written to the file, that particualr file is still created in the folder. How do I overcome this issue? I would like the file to be erased, when there's no data written to it.
Please advise.
Thanks
I have a Job writing data to four .csv files (in the Sequential file stages) at the end. I do have constraints defined for these satges.
Even though there's no data written to the file, that particualr file is still created in the folder. How do I overcome this issue? I would like the file to be erased, when there's no data written to it.
Please advise.
Thanks
dsx
Yup, that's the way it works. When the stage is 'started' the file is opened and created as a zero byte file if needed. There's no 'only create it if I write to it' option.
You'll need to do something after job, a script or batch file or routine that checks for a zero size and deletes if it is.
You'll need to do something after job, a script or batch file or routine that checks for a zero size and deletes if it is.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
File will be definetly create when you have the link.
Either you need to pre process or Post process for this.
Either you can check for the size and remove it from the OS or pass different value to the parameter to the job if the file need not to be create at some specific condition, say /dev/null.
Either you need to pre process or Post process for this.
Either you can check for the size and remove it from the OS or pass different value to the parameter to the job if the file need not to be create at some specific condition, say /dev/null.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Premium Member
- Posts: 503
- Joined: Wed Jun 29, 2005 8:14 am
Here, Ray created something like this a while back. Take a look
viewtopic.php?t=101158.
viewtopic.php?t=101158.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
You can go to the sequential file stage properties and uncheck "First line is column names" option. That will truely keep the file empty if its empty.
Look at Rays routine. He is using the STATUS function to determine the file size. STATUS() function returns different information in a dynamic array. The size info is present in the 6th entry in the array.
Look at Rays routine. He is using the STATUS function to determine the file size. STATUS() function returns different information in a dynamic array. The size info is present in the 6th entry in the array.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
If you click the link provided by DSGuru in one of his earlier posts, it will lead you to that thread where in second page you can find a routine written by Ray. I remember doing something similar in one of my earlier projects but I can't dig that routine at the moment. It's possible when I get back home and shall try doing that.
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson