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

INDEX ON vs dbcreateindex()

Status
Not open for further replies.

gmalavrazic

Programmer
Jun 23, 2000
29
RS
under Win2000/command prompt there is no difference between using eg.:
dbcreateindex("SUMKAT","kategorija",{|| kategorija})
dbsetindex("SUMKAT")

or
index on kategorija to sumkat
set index to sumkat


but under pure DOS 6.22 or 7(Win98) first option crashes after second line (open index file) with message:

DBFNTX 1012
Filename: SUMKAT.NTX
Description: Corruption detected


ANY IDEAS WHAT IS THE DIFFERENCE? [noevil]

 
Hi, Gmalavrazic

I tried your example under Win98 DOS window and it ran no problem.

Maybe it is a data issue - bad data in the index fields???

Aside from that, I dunno.

Best regards
Jock
 
If field kategorija is numeric then you'll eventually run into trouble. Use Str() function to convert to string angd your corruption will be bearable ;-)

Grtz, TonHu
 
for JockMullin
I said that the problem is only under DOS 6.22 or 7(not under Windows DOS prompt). The configuration is the following:
config.sys:
DEVICE=HIMEM.SYS
DEVICE=EMM386.EXE NOEMS
BUFFERS=40,0
FILES=200
DOS=UMB,UMB
DEVICEHIGH =TEAC_CDI.SYS /D:TEAC-CDI
autoexec.bat:
LH MSCDEX.EXE /D:TEAC-CDI /M:15
SET CLIPPER=F200

for TonHu
the field kategorija is C2

[hammer]
 
HI, again

Tried again with Win98 in DOS mode and was able to reproduce your problem.

The interesting thing is really the dbsetindex line is unnecessary since the dbcreateindex already opens the index and if you eliminate the dbsetindex then it works fine.

Also if you close the index (set index to) before the dbsetindex line then it also works fine.

This is a cute problem. I am wondering if it has something to do with no NETBIOS emulation in DOS mode. The dbsetindex command is additive i.e. it adds the index to any already in use. If the index being added is already open in that area it should close it first but I am thinking there is a bug there whereby it is giving itself a sharing violation and interpreting that as corruption.

Brgds
Jock
 
The Norton Guides for 5.2 says:
DBSETINDEX() opens an index file for the current work area. Any index files already associated with the work area continue to be active.

Since you are trying to open the index twice there are bound to be problems. SET INDEX TO should work as it closes all open indexes.

The Norton Guide says:
SET INDEX closes all currently open index files then opens the specified index files in the current work area.
Ian Boys
DTE Systems Ltd
 
To Bozz

Yes, I saw that also.

However, if you put two dbsetindex's in a row for the same index it works OK - it only fails on the first on after an index create.

I still think it is a Clipper bug.

Brgds
Jock
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top