'**** HEADER ************************************************************
'EXINDX01.PF3 (release .02)
'Copyright (c) 1990-1991 Applied Resource Technologies, Inc.
'P.O. Box 64381, Dallas, Texas 75206 U.S.A. (214) 855-0449
'Description: Demonstrates makeidx()
'**** FUNCTION DECLARATIONS *********************************************
'library
external makeidx()
'core
'**** VARIABLE DECLARATIONS *********************************************
'library
external lpath dpath
'core
'**** CODE **************************************************************

local dfname idxname fnum currpath rec_counter t_records prec_string

dfname = "scratch" 'named after the standard view, in this case
idxname = "exindx02"
fnum = 3
currpath = NULL
rec_counter = 0

file unload all
load lpath|"indexlib.psl" in-memory
file load standard-view dpath|dfname
order change physical

t_records = records

if file(idxname|".idx") = TRUE
     tools file erase idxname|".idx"
end if

if t_records > 25 'we just want up to 25 records for the example
  t_records = 25
end if

data goto record first

while TRUE
  if record > t_records
   exit while
  end if
  prec_string = prec_string & str(precord)
  data goto record next
  rec_counter=rec_counter+1
end while

makeidx(dfname,idxname,prec_string,4)

order change index idxname

data goto record first

label abort

unload "indexlib.psl"




