I have an index repair utility that I pass a table name to it and it creates index expressions based on the current table tags and writes them to a procedure file me to run to recreate index. I use the following expression:
'INDEX ON ' + LOWER(SYS(14, lnTag)) + ' TAG ' + LOWER(TAG(lnTag))
My problem is that sys(14) and key() do not pull FOR clauses out of index expressions nor do they pull the UNIQUE. Is there anything that does?
Here is the block of code:
FOR i = 1 TO ALEN(dbfnames,1)
USE (m.srcdir+dbfnames(i,1))
=fputs(m.handle,'')
=fputs(m.handle,REPLI('*',40))
=fputs(m.handle,'PROCEDURE mf_'+LEFT(dbfnames(i,1),AT('.',dbfnames(i,1))-1))
=fputs(m.handle,REPLI('*',40))
COPY STRUC TO TEMPFILE EXTENDED
USE TEMPFILE
=fputs(m.handle,' DIMENSION fieldinfo('+ALLTRIM(str(reccount()))+',4)')
SCAN
=fputs(m.handle,' fieldinfo('+ALLTRIM(str(RECNO()))+',1) = '+"'"+rtrim(FIELD_NAME)+"'")
=fputs(m.handle,' fieldinfo('+ALLTRIM(str(RECNO()))+',2) = '+"'"+FIELD_TYPE+"'")
=fputs(m.handle,' fieldinfo('+ALLTRIM(str(RECNO()))+',3) = '+alltrim(str(field_len)))
=fputs(m.handle,' fieldinfo('+ALLTRIM(str(RECNO()))+',4) = '+alltrim(str(field_dec)))
ENDSCAN
=fputs(m.handle,'RETURN')
USE (m.srcdir+dbfnames(i,1))
=fputs(m.handle,'')
=fputs(m.handle,REPLI('*',40))
=fputs(m.handle,'PROCEDURE ix_'+LEFT(dbfnames(i,1),AT('.',dbfnames(i,1))-1))
=fputs(m.handle,REPLI('*',40))
FOR lnTag = 1 TO tagcount()
=fputs(m.handle,'INDEX ON ' + LOWER(SYS(14, lnTag)) + ' TAG ' + LOWER(TAG(lnTag)))
ENDFOR
USE
=fputs(m.handle,'RETURN')
ENDFOR
TIA!
TRACY
:o)
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"