home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
dedit.zip
/
EDIT.PRG
< prev
next >
Wrap
Text File
|
1986-06-20
|
2KB
|
76 lines
clear
store space(10) to datafile
do while datafile = space(10)
clear
@ 6,10 say "Name of DBF file to edit? ";
get datafile picture "!!!!!!!!"
read
clear
store datafile+".DBF" to d1
if .not. file("&d1")
@ 7,10 say "File does not exist."
store space(10) to datafile
endif
enddo
store 1 to rn
do while rn > 0
store 0 to rn
@ 8,10 say "Record number to edit " get rn picture "99999"
@ 9,10 say "( 0 to exit / <negative> # to append)"
read
clear gets
if rn = 0
loop
endif
use &datafile
store "EDITING " to wrd
* appending
if rn < 0
append blank
go bottom
store RECNO() to rn
store "ADDING TO " to wrd
endif
go top
if EOF()
@ 12,10 say "File is empty and cannot be edited."
return
endif
go bottom
if rn > recno()
@ 12,10 say "Record number exceeds records in file. "+;
"Editing Last Record"
store recno() to rn
endif
goto rn
clear
store 2 to row
@ 1,0 say wrd+"file "+trim(datafile)+"DBF Rec # "+str(rn,5)
for I = 1 to 1024
if row > 22 .or. "" = fieldname(I)
store 2 to row
read
clear gets
@ 2,0 clear
endif
if "" = fieldname(I)
store 1025 to i
loop
endif
@ row,1 say fieldname(I)
store fieldname(I) to fld
@ row, 13 get &fld
do case
case type(fieldname(I)) = "C"
if len(&fld) > 66
store row + int(len(&fld)/66) +1 to row
else
store row+1 to row
endif
otherwise
store row+1 to row
endcase
next i
@ 2,0 clear
enddo recordno