home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dedit.zip / EDIT.PRG < prev    next >
Text File  |  1986-06-20  |  2KB  |  76 lines

  1. clear
  2. store space(10) to datafile
  3. do while datafile = space(10)
  4. clear
  5.  @ 6,10 say "Name of DBF file to edit?  ";
  6.             get datafile picture "!!!!!!!!"
  7. read
  8. clear
  9. store datafile+".DBF" to d1
  10. if .not. file("&d1")
  11.  @ 7,10 say "File does not exist."
  12.  store space(10) to datafile
  13.  endif
  14. enddo
  15.  store 1 to rn
  16. do while rn > 0
  17.  store 0 to rn
  18.  @ 8,10 say "Record number to edit          " get rn picture "99999"
  19.  @ 9,10 say "( 0 to exit / <negative> # to append)"
  20.  read
  21.  clear gets
  22. if rn = 0
  23.  loop
  24. endif
  25. use &datafile
  26. store "EDITING " to wrd
  27. * appending
  28. if rn < 0
  29.  append blank
  30.  go bottom
  31.  store RECNO() to rn
  32.  store "ADDING TO " to wrd
  33. endif
  34. go top
  35. if EOF()
  36.  @ 12,10 say "File is empty and cannot be edited."
  37.  return
  38. endif
  39. go bottom
  40. if rn > recno()
  41. @ 12,10 say "Record number exceeds records in file. "+;
  42.              "Editing Last Record"
  43. store recno() to rn
  44. endif
  45. goto rn
  46. clear
  47. store 2 to row
  48. @ 1,0 say wrd+"file "+trim(datafile)+"DBF  Rec # "+str(rn,5)
  49. for I = 1 to 1024
  50. if row > 22 .or. "" = fieldname(I)
  51. store 2 to row
  52. read
  53. clear gets
  54. @ 2,0 clear
  55. endif
  56. if "" = fieldname(I)
  57. store 1025 to i
  58. loop
  59. endif
  60. @ row,1 say fieldname(I)
  61. store fieldname(I) to fld
  62. @ row, 13 get &fld
  63. do case
  64. case type(fieldname(I)) = "C"
  65. if len(&fld) > 66
  66. store row + int(len(&fld)/66) +1 to row
  67. else 
  68. store row+1 to row
  69. endif
  70. otherwise
  71. store row+1 to row
  72. endcase
  73. next i
  74. @ 2,0 clear
  75. enddo recordno
  76.