home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
24b
/
ntxerr.zip
/
OPEN_ERR.PRG
next >
Wrap
Text File
|
1988-08-31
|
2KB
|
66 lines
***
* open_error(name, line, info, model, _1)
*
FUNCTION open_error
PARAM name, line, info, model, _1
IF NETERR() .AND. model == "USE"
RETURN .F.
END
* The following is a check for a missing/corrupt index. It has a call to
* RedoIndex() which I intend to have in the top calling module of my
* applications for clarity/consistensy, but could appear anywhere.
* Each index used must be hardcoded in RedoIndex().
* Once the index has been created/recreated, program execution continues
* as normal, with the requested file in USE in the specified area.
* Written Jan 18/88 by Brian Loesgen (Wow! My first S'87 UDF!) with
* assistance from Bill Steele.
* If anyone finds anything wrong with this, PLEASE let me know either
* on CRS -or- PCanada PC2098 -or- CIS 17326,1174 -or- Source BFG491
* OPENERRO.PRG
* This is a direct replacement for OPEN_ERROR in ERRORSYS.PRG
* It contains everything that was in OPEN_ERROR before, plus the NTX check.
* This is public domain, as is, no warrantees at all, etc...
IF model = "SET INDEX"
cl_dbf = ALIAS() && .DBF name
cl_index = SUBSTR(_1,1,AT(".",_1)-1) && .NTX name
@23,0 CLEA
IF .NOT. FILE("&_1")
@24,1 SAY "Index &cl_index is missing. Reindexing..."
ELSE
@24,1 SAY "Index &cl_index appears to be corrupted. Reindexing..."
ENDIF
RedoIndex()
@23,0 CLEA
RETURN .F.
ELSEIF .NOT. FILE(ALIAS()+".DBF")
@23,0 CLEAR
@24,0 SAY "Database "+ALIAS()+" not found! -- Aborting..."
RETURN .T.
ELSE && ... The following IF NOT an index error
SET DEVICE TO SCREEN
@ 0, 0
@ 0, 0 SAY "Proc " + M->name + " line " + LTRIM(STR(M->line)) + ", " +;
M->info + " " + M->_1 + " (" + LTRIM(STR(DOSERROR())) + ")"
@ 0, 65 SAY "Retry? (Y/N)"
INKEY(0)
DO WHILE .NOT. CHR(LASTKEY()) $ "YyNn"
INKEY(0)
END
IF .NOT. CHR(LASTKEY()) $ "Yy"
QUIT
ENDIF
@ 0,0
RETURN .T.
ENDIF
RETURN .T.