Page 1 of 1

wait for file activity

Posted: Sun Jul 17, 2005 10:51 pm
by satyakunta
Hello,

I have a strange problem with respect to the wait for file activity:

i am trying to write to a sequential file from a table giving the status of the job sucessfully run or not,
i put the constraint on the trnsformer that if the count(status)=0 write to the file with single column as "sucessful"which means that if the count of "N" (i.e NO) = 0 then it writes to the file at a specified location (it creates a dat file)

but when the count is > 0 then it should not write to the file, and it should not generate a file, but to my surprise the job is creating a 0kb file which the wait for file activity takes as present and the runs the next step.

If it were to be in unix i would have used test-s command to check the size of file>0, but i am working on NT.

Is there any DOS commond to check the size of the file greater than 0kb and to delete the file?

or is there a better way to do this.

Thanks

Satya

Posted: Sun Jul 17, 2005 11:07 pm
by chulett
Welcome. :D

You can't stop the stage from creating the file, it does so when the stage cranks up or 'opens'. If you don't write to it, what you are left with is a zero byte file. As you've found.

Given the path you've been taking with this, I'd suggest you write your output file to a different name, one the Wait For File activity is not polling for. Take the mechanism you are using for the constraint right now and pass that count or status out to an 'after job' script. Based on that parameter, have the script either rename the file to what the wait activity is expecting or... delete it.

I would think something like that would work.

Posted: Mon Jul 18, 2005 12:28 am
by ray.wurlod
Is there any DOS command to check the size of the file greater than 0kb and to delete the file?
If you're on 7.5 with MKS toolkit, or have MKS toolkit anyway, then you can write a UNIX script to do this. Something like:

Code: Select all

if [ -z $filename ] then
   rm $filename
fi
I don't know if there's a DOS equivalent. Maybe there is, maybe there isn't. But just crank up sh and you can do the UNIX thing. From a cmd shell, just type sh (the prompt changes to "$"). Then type man sh to find out more about the shell.