Just starting out here old CLIPPER programmer with tons of code to update to foxpro your answers to others questions has allready helped me get past some questions thanks.
I do have a tip on index files.
I use a function to open files called NETOPEN
I am running Novell 5.1 and CLIPPER/DOS EXEs
It checks for index files and creates them if they are not found. If you get a courupted index file the user can just delete the file and rerun the program to create new index files. Any new programs will have an reindex button.
There is a question though, is there a good way of checking if index files are courupted?
Here is the calling code: up to 4 index files.
Table index name Field name
netopen('PRINTERS','tmpprint' , 'pname')
and the function:
FUNCTION NETOPEN
local tmpscr
PARAMETERS FIL,NTX1,FLD1,NTX2,FLD2,NTX3,FLD3,NTX4,FLD4
TMPSCR=SAVESCREEN(0,0,24,79)
if .not.net_use(FIL,.f.,3)
err('Unable to open '+FIL)
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
DO CASE
CASE PCOUNT()>2
if .not.file(NTX1+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
unlock
else
err('Unable to create index file',NTX1)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>4
if .not.file(NTX2+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
unlock
else
err('Unable to create index file',NTX2)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>6
if .not.file(NTX3+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
SHOWINDEX(FLD3,NTX3)
index on &FLD3 to &NTX3
unlock
else
err('Unable to create index file',NTX3)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>8
if .not.file(NTX4+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
SHOWINDEX(FLD3,NTX3)
index on &FLD3 to &NTX3
SHOWINDEX(FLD4,NTX4)
index on &FLD4 to &NTX4
unlock
else
err('Unable to create index file',NTX4)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
ENDCASE
UNLOCK
DO CASE
CASE PCOUNT()>8
set index to &NTX1,&NTX2,&NTX3,&NTX4
CASE PCOUNT()>6
set index to &NTX1,&NTX2,&NTX3
CASE PCOUNT()>4
set index to &NTX1,&NTX2
CASE PCOUNT()>2
set index to &NTX1
OTHERWISE
SET INDEX TO
ENDCASE
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.T.)
I do have a tip on index files.
I use a function to open files called NETOPEN
I am running Novell 5.1 and CLIPPER/DOS EXEs
It checks for index files and creates them if they are not found. If you get a courupted index file the user can just delete the file and rerun the program to create new index files. Any new programs will have an reindex button.
There is a question though, is there a good way of checking if index files are courupted?
Here is the calling code: up to 4 index files.
Table index name Field name
netopen('PRINTERS','tmpprint' , 'pname')
and the function:
FUNCTION NETOPEN
local tmpscr
PARAMETERS FIL,NTX1,FLD1,NTX2,FLD2,NTX3,FLD3,NTX4,FLD4
TMPSCR=SAVESCREEN(0,0,24,79)
if .not.net_use(FIL,.f.,3)
err('Unable to open '+FIL)
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
DO CASE
CASE PCOUNT()>2
if .not.file(NTX1+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
unlock
else
err('Unable to create index file',NTX1)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>4
if .not.file(NTX2+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
unlock
else
err('Unable to create index file',NTX2)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>6
if .not.file(NTX3+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
SHOWINDEX(FLD3,NTX3)
index on &FLD3 to &NTX3
unlock
else
err('Unable to create index file',NTX3)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
CASE PCOUNT()>8
if .not.file(NTX4+'.NTX')
if fil_lock(3)
SHOWINDEX(FLD1,NTX1)
index on &FLD1 to &NTX1
SHOWINDEX(FLD2,NTX2)
index on &FLD2 to &NTX2
SHOWINDEX(FLD3,NTX3)
index on &FLD3 to &NTX3
SHOWINDEX(FLD4,NTX4)
index on &FLD4 to &NTX4
unlock
else
err('Unable to create index file',NTX4)
use
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.F.)
endif
endif
ENDCASE
UNLOCK
DO CASE
CASE PCOUNT()>8
set index to &NTX1,&NTX2,&NTX3,&NTX4
CASE PCOUNT()>6
set index to &NTX1,&NTX2,&NTX3
CASE PCOUNT()>4
set index to &NTX1,&NTX2
CASE PCOUNT()>2
set index to &NTX1
OTHERWISE
SET INDEX TO
ENDCASE
RESTSCREEN(0,0,24,79,TMPSCR)
RETURN(.T.)