I have a code segment that is occasionally logging an error. The
segment is below:

IF USED(gcsnapshot)
USE IN (gcsnapshot)
ENDIF

ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
ERASE (gctempdir + 'snap' + gcuserid + '.fpt')

gcsnapshot is the alias for the table gctempdir\snapgcuserid.dbf. I
believe that this table is closed in the first segment of code and then
the intent is to delete the table prior to exitting.

The error being logged is "file is in use" and it nominates a file that
is actually open as the returned value from DBF() which is called in my
error handler. The error handler gets called 3 times and nominates the
line numbers for each of the erase commands as the line numbers for the
errors.

In my error handler I do a LIST STATUS and nowhere in the status output
is there a reference to the "snap" files so I am assuming that the file
is in fact closed and so it should be erasible.

I am wondering if the erase is being attempted before the table is
actually closed and so logging the error (and the reference to the other
file is just an artifact of the state of the application at the time).
If that is the case what can I do to delay the execution of the erase
commands until after the table is closed properly?

This is in VFP 7



thanks

pete

Re: Wrong file? by Man-wai

Man-wai
Thu Apr 05 03:00:22 CDT 2007

The error being logged is "file is in use" and it nominates a file that
> is actually open as the returned value from DBF() which is called in my
> error handler. The error handler gets called 3 times and nominates the
> line numbers for each of the erase commands as the line numbers for the
> errors.

How many copies of the program were running?


--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.20.4
^ ^ 15:59:01 up 12 days 3:11 0 users load average: 1.04 1.03 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Re: Wrong file? by Dan

Dan
Thu Apr 05 11:16:22 CDT 2007

If you USE IN (gcsnapshot) you should then be using ERASE (gcsnapshot).
You're using different naming conventions here, which makes it quite
possible to be operating on different files. (I realize there's a path
involved in one and not the other. But the idea stands.)

We do this kind of thing all over the place and I've never seen this error
before.

I suspect you're closing one file and then trying to erase another.

Dan


"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.207f183efadee0e79896a8@news.easynews.com...
>
> I have a code segment that is occasionally logging an error. The
> segment is below:
>
> IF USED(gcsnapshot)
> USE IN (gcsnapshot)
> ENDIF
>
> ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
> ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
> ERASE (gctempdir + 'snap' + gcuserid + '.fpt')
>
> gcsnapshot is the alias for the table gctempdir\snapgcuserid.dbf. I
> believe that this table is closed in the first segment of code and then
> the intent is to delete the table prior to exitting.
>
> The error being logged is "file is in use" and it nominates a file that
> is actually open as the returned value from DBF() which is called in my
> error handler. The error handler gets called 3 times and nominates the
> line numbers for each of the erase commands as the line numbers for the
> errors.
>
> In my error handler I do a LIST STATUS and nowhere in the status output
> is there a reference to the "snap" files so I am assuming that the file
> is in fact closed and so it should be erasible.
>
> I am wondering if the erase is being attempted before the table is
> actually closed and so logging the error (and the reference to the other
> file is just an artifact of the state of the application at the time).
> If that is the case what can I do to delay the execution of the erase
> commands until after the table is closed properly?
>
> This is in VFP 7
>
>
>
> thanks
>
> pete



Re: Wrong file? by Peter

Peter
Thu Apr 05 18:40:26 CDT 2007


> If you USE IN (gcsnapshot) you should then be using ERASE (gcsnapshot).
> You're using different naming conventions here, which makes it quite
> possible to be operating on different files. (I realize there's a path
> involved in one and not the other. But the idea stands.)

I wondered about that.

> I suspect you're closing one file and then trying to erase another.

When I examine the List Status output, the table nominated in the erase
statement is not present (it is at other times).

> > ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
> > ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
> > ERASE (gctempdir + 'snap' + gcuserid + '.fpt')

The table that is throwing the error has a name Tableuse that could not
be mis-constructed in the lines above.


thanks


Re: Wrong file? by swdev2

swdev2
Sun Apr 08 21:58:37 CDT 2007

try
IF USED('gcsnapshot')
USE IN ('gcsnapshot')
ENDIF

if gcsnapshot is not a memory variable. (i think it is a memory variable)

also - how many data environments are in use at run time when this error is
thrown ?
it could be that you have the same table name used in 2 DE's at once.
when you close a table in 1 DE, it doesn't close it in the 2nd one.
VFP won't erase it, is side effect .

Mondo Regards [Bill]
--
===================
William Sanders / EFG VFP / mySql / MS-SQL
www.efgroup.net/vfpwebhosting
www.terrafox.net www.viasqlserver.net

"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.207f183efadee0e79896a8@news.easynews.com...
>
> I have a code segment that is occasionally logging an error. The
> segment is below:
>
> IF USED(gcsnapshot)
> USE IN (gcsnapshot)
> ENDIF
>
> ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
> ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
> ERASE (gctempdir + 'snap' + gcuserid + '.fpt')
>
> gcsnapshot is the alias for the table gctempdir\snapgcuserid.dbf. I
> believe that this table is closed in the first segment of code and then
> the intent is to delete the table prior to exitting.
>
> The error being logged is "file is in use" and it nominates a file that
> is actually open as the returned value from DBF() which is called in my
> error handler. The error handler gets called 3 times and nominates the
> line numbers for each of the erase commands as the line numbers for the
> errors.
>
> In my error handler I do a LIST STATUS and nowhere in the status output
> is there a reference to the "snap" files so I am assuming that the file
> is in fact closed and so it should be erasible.
>
> I am wondering if the erase is being attempted before the table is
> actually closed and so logging the error (and the reference to the other
> file is just an artifact of the state of the application at the time).
> If that is the case what can I do to delay the execution of the erase
> commands until after the table is closed properly?
>
> This is in VFP 7
>
>
>
> thanks
>
> pete



Re: Wrong file? by RGBean

RGBean
Mon Apr 09 07:34:52 CDT 2007

Or if you want to do it in a single line:
USE IN SELECT('gcsnapshot')

Rick

"swdev2" <wsanders@dotnetconversions.bob.com> wrote in message
news:e9Fp2nkeHHA.4772@TK2MSFTNGP05.phx.gbl...
> try
> IF USED('gcsnapshot')
> USE IN ('gcsnapshot')
> ENDIF
>
> if gcsnapshot is not a memory variable. (i think it is a memory variable)
>
> also - how many data environments are in use at run time when this error
> is
> thrown ?
> it could be that you have the same table name used in 2 DE's at once.
> when you close a table in 1 DE, it doesn't close it in the 2nd one.
> VFP won't erase it, is side effect .
>
> Mondo Regards [Bill]
> --
> ===================
> William Sanders / EFG VFP / mySql / MS-SQL
> www.efgroup.net/vfpwebhosting
> www.terrafox.net www.viasqlserver.net
>
> "Peter Huish" <huish@ozemail.com.au> wrote in message
> news:MPG.207f183efadee0e79896a8@news.easynews.com...
>>
>> I have a code segment that is occasionally logging an error. The
>> segment is below:
>>
>> IF USED(gcsnapshot)
>> USE IN (gcsnapshot)
>> ENDIF
>>
>> ERASE (gctempdir + 'snap' + gcuserid + '.dbf')
>> ERASE (gctempdir + 'snap' + gcuserid + '.cdx')
>> ERASE (gctempdir + 'snap' + gcuserid + '.fpt')
>>
>> gcsnapshot is the alias for the table gctempdir\snapgcuserid.dbf. I
>> believe that this table is closed in the first segment of code and then
>> the intent is to delete the table prior to exitting.
>>
>> The error being logged is "file is in use" and it nominates a file that
>> is actually open as the returned value from DBF() which is called in my
>> error handler. The error handler gets called 3 times and nominates the
>> line numbers for each of the erase commands as the line numbers for the
>> errors.
>>
>> In my error handler I do a LIST STATUS and nowhere in the status output
>> is there a reference to the "snap" files so I am assuming that the file
>> is in fact closed and so it should be erasible.
>>
>> I am wondering if the erase is being attempted before the table is
>> actually closed and so logging the error (and the reference to the other
>> file is just an artifact of the state of the application at the time).
>> If that is the case what can I do to delay the execution of the erase
>> commands until after the table is closed properly?
>>
>> This is in VFP 7
>>
>>
>>
>> thanks
>>
>> pete
>
>


Re: Wrong file? by Peter

Peter
Mon Apr 09 14:12:09 CDT 2007

> try
> IF USED('gcsnapshot')
> USE IN ('gcsnapshot')
> ENDIF
>
> if gcsnapshot is not a memory variable. (i think it is a memory variable)

Yes it is. A global variable.

>
> also - how many data environments are in use at run time when this error is
> thrown ?
> it could be that you have the same table name used in 2 DE's at once.
> when you close a table in 1 DE, it doesn't close it in the 2nd one.
> VFP won't erase it, is side effect .

I wondered about that but wouldn't the open table appear in the output
of List Status?


thanks

pete


Re: Wrong file? by Anders

Anders
Mon Apr 09 14:17:19 CDT 2007

IF gcsnapshot is a variable:
IF USED(gcsnapshot)
USE IN (gcsnapshot)
ENDIF

-Anders

"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.20853aecc9c6d6919896aa@news.easynews.com...
>> try
>> IF USED('gcsnapshot')
>> USE IN ('gcsnapshot')
>> ENDIF
>>
>> if gcsnapshot is not a memory variable. (i think it is a memory variable)
>
> Yes it is. A global variable.
>
>>
>> also - how many data environments are in use at run time when this error
>> is
>> thrown ?In rthat case

>> it could be that you have the same table name used in 2 DE's at once.
>> when you close a table in 1 DE, it doesn't close it in the 2nd one.
>> VFP won't erase it, is side effect .
>
> I wondered about that but wouldn't the open table appear in the output
> of List Status?
>
>
> thanks
>
> pete
>



Re: Wrong file? by Peter

Peter
Tue Apr 10 01:13:12 CDT 2007


> IF gcsnapshot is a variable:
> IF USED(gcsnapshot)
> USE IN (gcsnapshot)
> ENDIF

Its a public variable.