I have a CFEXECUTE  in my code which creates  one outputfile on the server. A few steps later i've CFFILE ACTION="READ" for which I get a CF error as follows:

Error processing CFFILE.Error attempting to read c:\Inetpub\wwwroot\announcement\envl_check\2003J27512170000159377.txt.The process cann't access the file because it is being used by another process (error 32)

The error occurred while processing an element with a general identifier of (CFFILE),occupying document position (210:1) to (210:116)

Any Clue what's going wrong?

CODE is as follows:

<CFEXECUTE NAME="#Local.DirPath#\dll\wavenv.exe"    
      ARGUMENTS='-c -p1000 "#Local.DirPath#\announcement\wav_temp\#Local.FileName#"'

<!--- Read the output from the envelope detector into a variable --->
<cffile action="READ" file="#Local.DirPath#announcement\envl_check\#Local.AnnNewName#.txt" variable="envelope_list">


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The cffile tag is executed as soon as ColdFusion does the cfexecute. So while your wavenv.exe is creating the file still coldfusion is trying to read it.  You'll have to come up with a way to wait for that file to become available. Also you want to make sure that the exe is closing the file once it is created and done with.

On possible way of doing things (probably not the best):

<cfloop condition="proccessing eq 1">
      <cfset proccessing = 0>
      <cffile action="READ" file="#Local.DirPath#announcement\envl_check\#Local.AnnNewName#.txt" variable="envelope_list">
            <cfcatch type="any">
            <cfset proccessing = 1>

PE_CF_DEV is right about the conflict between wavenv.exe and cffile. But, the loop could go on forever if something goes wrong. Better add a time out to it:

<cfset processing=1>
<cfset start = now()>
<!--- should exit if file can be read or after 15 secs. --->
<cfloop condition="processing EQ 1 AND DateDiff("s", start, now()) LTE 15>
   <!--- rest of code like above --->



swatisAuthor Commented:
Sorry for the late relpy but the problem was with exe itself.At last found it
PAQed, with points refunded (40)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.