Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

End of file error, after append blank

Status
Not open for further replies.

1836

Technical User
Jun 19, 2008
18
Hi

I am doing an: append blank & then a gather memvar. The program is giving an "End of file encountered." error during the gather memvar. What can cause this to happen? This is running in VFP version 6. Also the DBF that this is happeing to has over 1,900,000 56 byte records.

thank you
 
Are you sure you're in the right work area? If your code is actually:

APPEND BLANK IN MyWorkArea
GATHER MEMVAR

you could get an error like this.

Tamar
 
Just a guess --
Have you got any active Index or Filter on the table during the code execution?

If so, the APPEND BLANK could indeed be creating the new record, but it may be 'masked' out by an Index or Filter which will dis-allow certain empty fields - thereby resulting in your record pointer being pointed to EOF.

Good Luck,
JRB-Bldr

 
I have an index but not a filter.
The line of code prior to this is 'sele 3'.

This is happening during the part of the day which has the heaviest traffic (approx 5 workstations). At this time I intend to 1) upgrade to VFP 9, 2)move some records to history.
 
Sele 3 is a sign you've still not come to using aliases. In times ther only were 15 work areas you surely would have assigned some workarea numbers to certain tables. But nowadays this can get you into trouble.

Bye, Olaf.
 
Depending on the Index Expressions, what I said might be the problem.

INDEX ON eExpression TO IDXFileName | TAG TagName [OF CDXFileName] [FOR lExpression]

For example you could have a problem with a Blank record if the active Index were containing something like:
Code:
INDEX ON Field2 TAG Fld2 [B]FOR !EMPTY(Field2)[/B]
    or
INDEX ON [B]!EMPTY(Field2)[/B] TAG Fld2

And I agree with Olaf above, get rid of using references to Workspaces (SELECT 3).
Instead use the Alias name such as:
Code:
SELECT ThisDBF  && Replacing old code - SELE 3
APPEND BLANK
GATHER MEMVAR
It will better ensure that you are working on the expected table and not, by accident, on another table.

Another item to check is what you are using for your SCATTER MEMVAR source. If the source data is not really as expected, then, after the GATHER MEMVAR, the record contents might not be as intended and the Index might be preventing the new record from being seen.

To test out where the problem might be...
1. Make a copy of your data table and do the following Test work on the copy, not the original.
2.
Code:
USE DBFCopy in 0 
SELECT DBFCopy
* --- Test First with No Active Index ---
SCATTER MEMVAR
APPEND BLANK
GATHER MEMVAR
3. BROWSE
4. Examine the results. Record #1 should look the same as the last record.

If everything works in this non-index test, then the problem is either the source of the MEMVAR data or it is a problem with the Index.

Good Luck,
JRB-Bldr
 
SELECT 3 is probably the problem. Try changing it to:

SELECT <the alias for the table of interest>

It's never a good idea to refer to work areas by number or letter, only by the alias of the table open in the work area.

You might want to get your hands on the July issue of the new magazine, FoxRockX, to read about how you can avoid all kinds of problems by referring to work areas properly.


Tamar
 
why not:
Insert into MyTable from MEMVAR





Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top