'FILE_FIX - filefix all files

external   dpath messbox() vloadif() vunloadif() progress() progtag() fgi bgi
external   sch scw

public     ptstr

global     x $module $files y

MAIN
single-step off
  file unload all
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  smartpeek $_modl $module
  $files = GETFNAMES(dpath|"*.vws"|($module),0)
'   messbox(" You are about to FILE-FIX ALL data files on drive:"&upper(dpath)|" ",0,1,1)
'   messbox(" Confirm ALL files on ALL workstations have been unloaded - y/n ",1,0,1)
'   if ptstr == "n"
'     exit main
'   end if
  x = 1
  progress(15,9," File-fixing data file ",1)
  while GROUP($files,x)<>null
'     vloadif(dpath|group($files,x)|".vws")

' y=upper(left(group($files,x),2))
' message "y is:"&str(y)
    if upper(left(group($files,x),2))="A_"    'message "A_"
      x = x + 1
      continue while
    end if

    progtag(fgi,bgi,dpath|group($files,x))
    data utilities file-fix data-file dpath|group($files,x)
'     order key rebuild
    if cerror
      message GROUP($files,x)|".vws - ERROR in file"
    end if
    vunloadif(group($files,x)|".vws")
    x = x + 1
  end while
END MAIN

