home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug104.arc
/
MENU.LBR
/
MAINT.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1979-12-31
|
12KB
|
649 lines
*
* maint.cmd
*
* Glenn Story - 6/12/83
*
* This command file contains the routines to be used for menu-driven
* dBASE II file maintenance
* This command file is used in conjunction with MENU.CMD
*
do case
*
CASE MAINT:CMD = 'MADF'
*
do muse
copy to temp structure
use temp
?
? 'WARNING: Do not change any field names'
?
modify structure
append from &cur:file
erase
? 'At this point we are about to copy remove the old data base and'
? 'replace it with the new one'
? ' '
? 'Press ESC to abort and save the old data base'
? 'or press any other key to continue'
wait
delete file &cur:file
rename temp to &cur:file
*
CASE MAINT:CMD = "MADD"
*
do muse
append
*
CASE MAINT:CMD = "MBROWSE"
*
do muse
browse
*
CASE MAINT:CMD = 'MCOM'
*
erase
modify command
*
CASE MAINT:CMD = 'MCREATE'
*
set intensity on
accept "Enter data base name: " to cur:file
create &cur:file
set intensity off
use &cur:file
do mindex
*
CASE MAINT:CMD = 'MDELETE'
*
erase
store '? ' to file:name
do while file:name = '?'
@ 2,10 say 'Enter name of file to be deleted: ' get file:name
read
if file:name = "?"
list files like *.*
endif
enddo
delete file &file:name
*
CASE MAINT:CMD = 'MLIST1'
*
erase
list files
wait
*
CASE MAINT:CMD = 'MLIST2'
*
do muse
erase
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD = 'MLIST4'
*
erase
list memory
wait
*
CASE MAINT:CMD = 'MRENAME'
*
DO muse
copy to temp sdf
?
? 'WARNING: Do not change any field sizes'
?
modify structure
append from temp.txt sdf
*
CASE MAINT:CMD = 'MRENF'
*
erase
store '? ' to old:name
do while old:name = '?'
@ 2,10 say "Enter old name: " get old:name
read
if old:name = '?'
list files like *.*
endif
enddo
store '? ' to new:name
do while new:name = '?'
@ 4,10 say "Enter new name: " get new:name
read
if new:name = '?'
list files like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read
store !(old:new) to old:new
enddo
if old:new = 'Y'
store '? ' to form:name
do while form:name = '?'
erase
@ 2,10 say "Enter form name" get form:name
read
if form:name = '?'
erase
list files like *.frm
loop
endif
store trim (form:name)+'.FRM' to file:name
if .not. file (file:name)
@ 4,10 say 'Form file does not exist'
wait
store '? ' to form:name
loop
endif
enddo
else
store ' ' to temp:sw
do while (temp:sw # 'Y') .and. (temp:sw # 'N')
@ 4,10 say 'Do you want to keep the new form? ' get temp:sw
read
store !(temp:sw) to temp:sw
enddo
if temp:sw = 'Y'
store ' ' to form:name
do while form:name = ' '
@ 6,10 say 'Enter new form name: ' get form:name
read
if file (form:name)
@ 8,10 say 'file already exists - pick another name'
store ' ' to form:name
endif
enddo
else
store 'TEMP' to form:name
if file ('TEMP.FRM')
delete file temp.frm
endif
endif
endif
store ' ' to print:sw
do while (print:sw # 'Y') .and. (print:sw # 'N')
accept "Do you want the output to go the printer? " to print:sw
store !(print:sw) to print:sw
enddo
if print:sw = 'Y'
store 'TO PRINT' to print:sw
else
store ' ' to print:sw
endif
accept "Enter scope of report" to scope
accept "Enter report heading" to heading
set heading to &heading
report form &form:name &scope &print:sw
wait
*
CASE MAINT:CMD = 'MINDEX'
*
do muse
do mindex
*
CASE MAINT:CMD = 'MUPDATE'
*
* (This one must be last since it has its own CASEs - dBASE
* can't handle nexted cases)
do muse
do while 1=1
erase
@ 2,10 say "Enter search key below"
@ 4,10 say "Or '?' for cursor-control info"
@ 6,10 say "Or blank to exit"
store ' ' to cur:key
@ 8,10 get cur:key
read
do case
case cur:key = ' '
store ' ' to pack:sw
do while (pack:sw # 'Y') .and. (pack:sw # 'N')
accept "Do you want to remove deleted records?" to pack:sw
store !(pack:sw) to pack:sw
enddo
if pack:sw = 'Y'
pack
endif
do mindex
return
case cur:key = '?'
store ' ' to choice
do help3
otherwise
store trim(cur:key) to cur:key
find &cur:key
if #=0
@ 10,10 say "Record not found"
wait
else
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD = 'MLIST4'
*
erase
list memory
wait
*
CASE wait
else
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD = 'MLIST4'
*
erase
list memory
wait
*
CASE mory
wait
*
CASE
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD = 'MLIST4'
*
erase
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read
store !(old:new) to old:new
enddo
if old:new = 'Y'
form:name = ' '
do while form:name = ' '
eile:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD = 'MLIST4'
*
erase
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read
store !(old:new) to old:new
enddo
if old:new = 'Y'
form:name = ' '
do while form:name = ' '
e
if file (form:name)
@ 8,10 say 'file already exists - pick another name'
se
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read
store !(old:new) to old:new
enddo
if old:new = 'Y'
form:name = ' '
do while form:name = ' '
e
if file (form:name)
@ 8,10 say 'file already exists - pick another name'
heading" to heading
set heading to &heading
report form &form:name &scope &print:sw
*
CASE MAINT:CMD = 'MINDEX'
*
do muse
do mindex
*
CASE MAINT:CMD = 'MUPDATE'
*
* (This one must be last since it has its own CASEs - dBASE
* can't handle nexted cases)
do muse
do while 1=1
erase
@ 2,10 say "Enter search key below"
@ 4,10 say "Or '?' for cursor-control info"
@ 6,10 say "Or blank to exit"
store ' ' to cer name'
heading" to heading
set heading to &heading
report form &form:name &scope &print:sw
*
CASE MAINT:CMD = 'MINDEX'
*
do muse
do mindex
*
CASE MAINT:CMD = 'MUPDATE'
*
* (This one must be last since it has its own CASEs - dBASE
* can't handle nexted cases)
do muse
do while 1=1
erase
@ 2,10 say "Enter search key below"
@ 4,10 say "Or '?' for cursor-control info"
@ 6,10 say "Or blank to exit"
store ' ' to c @ 10,10 say "Record not found"
wait
else
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD' to c @ 10,10 say "Record not found"
wait
else
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD 'MLIST4 @ 10,10 say "Record not found"
wait
else
edit *
endif
endcase
enddo
*
OTHERWISE
*
erase
? 'Illegal maint function '+maint:cmd
wait
*
ENDCASE
list structure
wait
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD 'MLIST4
*
erase
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read
*
CASE MAINT:CMD = 'MLIST3'
*
store '*.* ' to file:mask
erase
@ 2,10 say "Enter file mask: " get file:mask
read
erase
list files like &file:mask
wait
*
CASE MAINT:CMD 'MLIST4
*
erase
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read store !(old:new) to old:new
enddo
if old:new = 'Y'
form:name = ' '
do while form:name = ' '
e
if file (form:name)
@ 8,10 say 'file already exists - pick another name'
se
list memory
wait
*
CASE mory
wait
*
CASE s like *.*
endif
enddo
rename &old:name to &new:name
*
CASE MAINT:CMD = 'MREPORT'
*
DO muse
erase
store ' ' to old:new
do while (old:new # 'Y') .and. (old:new # 'N')
@ 2,10 say 'Do you want to use an existing form? ' get old:new
read store !(old:new) to old:new
enddo
if old:new = 'Y'
form:name = ' '
do while form:name = ' '
e
if file (form:name)
@ 8,10 say 'file already exists - pick another name'
heading" to heading
set heading to &heading
report form &form:name &scope &print:sw
*
CASE MAINT:CMD = 'MINDEX'
*
do muse
do mindex
*
CASE MAINT:CMD = 'MUPDATE'
*
* (This one must be last since it has its own CASEs - dBASE
* can't handle nexted cases)
do muse
do while 1=1