home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
dbase
/
moss
/
moss.prg
< prev
next >
Wrap
Text File
|
1986-11-09
|
3KB
|
145 lines
* PROGRAM BY ROBERT MOSS
* CIS ID#73717,47
* This program is a utility to make handling a database user-friendly.
* It allows you to search any database on a large number of fields;
* set a filter on the basis of a complex criterion;
* Index on any field;
* backup your database;
* add, delete, view, and change records;
* browse the database, and
* pack the database.
*
* The program will work on ANY database. The only restrictions are:
* - The FIRST field must be a text field. Searches will be faster
* if this field is the key field for an index.
* - In order to SELECT a subset of records, the database must contain
* a logical field called MARK.
public dab,filt,cl,cc,COND,con1,con2,con3,con4,con5,con6,con7,con8,con9,con10,con11,con12,con13,con14,con15,con16,con17,con18,con19
public filt,indx
filt=" ALL "
clear
dab=space(8)
do set
* SET chooses the database.
yn=" "
don=0
now=dtoc(date())
do while .t.
store 1 to start
set delete on
do while start=1
start=0
select 1
go top
clear
SET TALK OFF
enddo
DO WHILE start=0
clear
set color to W+
@2,10 SAY " DATABASE UTILITY PROGRAMS: Current Database:" +upper(dab)
f1=field(1)
@3,20 say " Current record: "+&f1
SET COLOR TO
@1,0 to 5,75 double
SET COLOR TO W,/W
if LEFT(FILT,1)="S"
@4,20 say "USING SELECTED RECORDS ONLY"
SET TALK OFF
set filter to &cond
go top
ENDIF
@6,5 SAY cdow(date())+", "+cmonth(date())+" "+str(day(date()),2)+", "+str(year(date()),4)+"; "+ str(recCOUNT(),4)+" records in database."
SEL=" "
set talk off
@8,2 say "0. SWITCH to another database"
@9,2 say "1. FIND a record"
@10,2 SAY "2. ADD a record to the list"
@11,2 SAY "3. DELETE this record "
@12,2 SAY "4. VIEW/CHANGE current record"
@13,2 say "5. SELECT records "
@18,42 say "C. Copy data onto floppy disks"
@19,42 say "Q. QUIT DBASE"
@8,42 say "A. reset to All records"
@9,42 SAY "B. Browse customer records"
@10,42 say "I. Index records (temporarily)"
@13,42 say "N. Go to Next record number"
@15,42 say "P. PACK database to recover space"
@7,0 TO 17,40 DOUBLE
@7,40 TO 17,79 DOUBLE
@17,0 TO 23,40 DOUBLE
@17,40 TO 23,79 DOUBLE
sel=" "
clear gets
@ 24,8 SAY "Input your selection:" get sel PICTURE "!"
read
clear
do case
case sel="0"
do set
case sel="P"
clear
set talk on
pack
go top
set talk off
case UPPER(SEL)="C"
clear
dr="A"
@ 2,2 say "Copy to which drive ?" get dr picture "!"
read
@ 3,2 say "Insert diskette in drive "+dr
wait
use
dr=dr+":"
dabf=trim(dab)+".d*"
indxf=trim(indx)+".ndx"
run copy &dabf &dr
if len(trim(indx))>0
run copy &indxf &dr
use &dab index &indx
else
use &dab
endif
case upper(sel)="I"
DO indf
case sel="Q"
?"Have a nice day!!"
quit
case sel="2"
APPEND
case sel="3"
clear
?"You wish to delete "+&f1+", Correct (Y/N)?"
wait to yn
if upper(yn)="Y"
delete
skip
endif
case sel$"14N"
if sel="1"
do find
ex=.f.
endif
if sel="N"
skip
endif
CLEAR
yn=" "
edit
case sel="5"
do report
case upper(sel)="A"
set filter to
case upper(sel)="B"
browse noappend lock 1
endcase
enddo
enddo