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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MEMO file is missing/invalid

Status
Not open for further replies.

JmichaelSR

Programmer
Mar 17, 2004
15
US
Please someone tell me what I am doing wrong here.

I have written a new program in FoxPro 2.5 and that program had been running successfully for about 2 months. All of a sudden, I started getting the message "Memo file is missing/invalid".

The Snippet I am having problems with follows:

FUNCTION _1h40mobwn && pb_exit VALID
#REGION 1
USE
USE arinvhdr IN 1 EXCLUSIVE
USE arinvdet IN 2 EXCLUSIVE **I GET THE ERROR MESSAGE HERE**
SELECT 1
PACK
SELECT 2
PACK
USE

I found references to this error message in Thread "thread182-904394" indicating that file size could be the problem. I attempted to fix the problem by completely deleting and re-creating file "arinvdet". To test, I ran the above code against the empty file and still got the error message.

What is really strange to me is that I can issue the exact code listed above (in the sequence shown)from the FoxPro Command Window and it works! There is evedently something in MY PROGRAM.

Any help or suggestions will be appreciated.

Thanks!

Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
Mike,
A Memo field stores it's information in the .FPT file that is the same name as your table (.DBF). If this file has been moved or deleted, you can get this error. In that case just restore it from your backup or move it back!

The other half of the error message happens when the .FPT file gets corrupted. Since your .DBF has pointers into the memo file, it's got to be able to recognize that the file actually has data at the indicated places. There are also internal links in the .FPT file that connect together pieces of individual memo field contents. So if the file gets truncated or "scrambled" due to a FAT problem, the file is considered "Invalid".

Rick
 
>arinvhdr IN 1
Is there some reason you're leaving this file open at the end of your function? Apparently a lone "USE" does less than you expect. If your code can recklessly close open tables, you should use CLOS DATA instead of USE.

FUNCTION _1h40mobwn && pb_exit VALID
#REGION 1
CLOS DATA
USE arinvhdr IN 1 EXCLUSIVE
USE arinvdet IN 2 EXCLUSIVE **I GET THE ERROR MESSAGE HERE**
SELECT 1
PACK
SELECT 2
PACK
CLOS DATA

I hope this is a cut version of the real function and it does a lot more than we can see. If what you show is all you wish to in this function, you should write it this way to for maximum program efficiency. There is no visible reason why the two tables should be open at the same time.

FUNCTION _1h40mobwn && pb_exit VALID
#REGION 1
CLOS DATA
USE arinvhdr EXCLUSIVE
PACK
USE arinvdet EXCLUSIVE
PACK
USE
 
Rick and SEVERACH,

Thank you very much for your help. SEVERACH the code I show is just a very small part of the program I've written. The snippet you see is used to pack 2 of the files involved in the program and is the last thing done before the program is exited. This snippet opens both files, selects file arinvhdr and packs it, then selects file arinvhdr and packs it and then closes ALL files with the command USE.

Like I was telling you guys, I can do queries, record updates, record adds, and record deletions to file arinvdet with out any problem. I can also issue, from the FoxPro COMMAND window, the commands "USE arinvhdr IN 1 EXCLUSIVE", "PACK", "USE" to close all files and they work fine. When I try to issue these same commands in my program, I get the error message I've been telling you about.

Rick could you explain to me what is meant by the FAT problem you refer to.

Guys I have been programming for a lot of years (mainly a COBOL programmer) but know nothing about FoxPro. I trying to pick it up on my own and am finding very little to help with my education. Can either of you suggest any places to look for help?

Thanks again for all your help.

Mike

Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
CHKDSK or SCANDISK or Scandisk for Windows will fix any FAT problem you may have but in doing so it may necessairly need to truncate or otherwise damage the files. Any such modification which is not performed by a proper xBase toolkit to the FPT file is likely to produce a file which will cause the error condition.
 
I really appreciate everyone's help with my problem.

I have resolved my problem which, proved to be a careless error on my part. What I found was that I had a created special Work Copy of arinvdet.dbf with no associated MEMO file and was pointing to this file by mistake. I deleted the work file and all works OK now.

I would still however, appreciate any information on where a beginning FoxPro 2.5 programmer could look for instruction.

Thanks again!

Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
In general, finding resources for FoxPro 2.5 won't be easy; that version is more than 10 years out of date. Probably the best book ever on FoxPro 2.x was "Using FoxPro 2.0" by Slater and Arnott; you might try to get a used copy somewhere.

It also appears that you're support SBT code. Unfortunately, that code is convoluted and complex (and not an example of elegant FoxPro code). I don't think there were any books written specifically about SBT's code, but you might find something helpful on the AccPac website, as they bought SBT a few years back.
Tamar
 
Thank You Tamar. I'll visit AccPac website.---Mike

Mike Clark
Programmer/Analyst
Mississippi State Fire Academy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top