home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Du Jour
/
SoftwareDuJour.iso
/
BUSINESS
/
DBASE
/
DBAPG.ARC
/
BACK_UP.PRG
< prev
next >
Wrap
Text File
|
1984-12-17
|
7KB
|
236 lines
* Program..: BACK_UP.PRG
* Author...: Tom Rettig
* Date.....: May 28, 1984
* Notice...: Copyright 1984 by Tom Rettig & Associates. All rights reserved.
* Version..: dBASE II, version 2.4x
* Notes....: For backing up changed files before exit from the
* application is allowed.
*
* Called by..: Main menu.
* Calls..: IN_rotat.mem Holds the designating letters
* of the last disks used.
*
* Initialize target drive designator (default drive is source)...
STORE 'B:' TO t:drive
*
* Get the last rotation used...
RESTORE FROM IN_rotat ADDITIVE
*
*
ERASE
SET COLOR TO sc:dim
@ 1, 0 SAY "B A C K U P C H A N G E D F I L E S"
@ 1,72 SAY mdate
@ 2, 0 SAY "========================================"+;
"========================================"
@ 21, 0 SAY "========================================"+;
"========================================"
SET COLOR TO sc:brt
*
STORE F TO t:is:mastr, t:is:loop
DO WHILE T
STORE 0 TO t:count
*
* Count the changed files, and display number...
IF bu:custm
STORE t:count + 1 TO t:count
ENDIF
IF bu:invtm
STORE t:count + 1 TO t:count
ENDIF
IF bu:prodm
STORE t:count + 1 TO t:count
ENDIF
IF bu:po
STORE t:count + 1 TO t:count
ENDIF
*
* Branch to exit if no (more) files to copy...
IF t:count = 0
* Save the rotation flags...
SAVE TO IN_rotat ALL LIKE ro:*
RELEASE ALL LIKE ro:*
IF .NOT. t:is:loop
@ 10,25 SAY "There are NO files to backup."
ELSE
@ 10,25 SAY " Backup process is complete. "
ENDIF
@ 23, 9 SAY "Press any key to QUIT, "+;
"or RETURN to return to the Main Menu..."
STORE '?' TO t:select
@ 23,71 GET t:select
READ NOUPDATE
CLEAR GETS
*
* Branch to quit or return...
IF t:select = '?'
RELEASE ALL LIKE ro:*
RELEASE ALL LIKE t:*
RETURN
ELSE
* This is the only exit point from the application system...
RELEASE ALL LIKE t:*
SAVE TO IN_const
ERASE
QUIT
ENDIF
ENDIF [t:count = 0]
*
* Display number of files to be copied...
IF t:count = 1
@ 10,25 SAY " There is 1 file to back up. "
ELSE
@ 10,25 SAY "There are " +STR(t:count,1)+ " files to back up."
ENDIF
*
* Branch for first time in the loop...
IF .NOT. t:is:loop
STORE T TO t:is:loop
ENDIF
*
*
*
* Branch to backup MASTER files: IN_invtm, IN_custm, and IN_prodm...
IF bu:invtm .OR. bu:custm .OR. bu:prodm
*
* Branch for prompt on the first loop only...
IF .NOT. t:is:mastr
STORE T TO t:is:mastr
@ 15,23 SAY "Place MASTER disk '" + ro:mastr + ;
"' in drive " + t:drive
@ 23,13 SAY "Press any key when ready, or RETURN to abort backup..."
STORE '?' TO t:select
@ 23,67 GET t:select
READ NOUPDATE
CLEAR GETS
@ 15,23
@ 23,13
*
* Branch to abort...
IF t:select = '?'
SAVE TO IN_rotat ALL LIKE ro:*
RELEASE ALL LIKE ro:*
RELEASE ALL LIKE t:*
RETURN
ENDIF
ENDIF
*
* Back them up...
IF bu:invtm
@ 15,24 SAY "Copying INVENTORY MASTER file..."
USE IN_invtm
COPY TO &t:drive.IN_invtm
USE
STORE F TO bu:invtm
IF bu:custm .OR. bu:prodm
@ 15,24
LOOP
ENDIF
ENDIF
*
IF bu:custm
@ 15,24 SAY "Copying CUSTOMER MASTER file..."
USE IN_custm
COPY TO &t:drive.IN_custm
USE
STORE F TO bu:custm
IF bu:prodm
@ 15,24
LOOP
ENDIF
ENDIF
*
IF bu:prodm
@ 15,24 SAY "Copying PRODUCT MASTER file... "
USE IN_prodm
COPY TO &t:drive.IN_prodm
USE
STORE F TO bu:prodm
ENDIF
*
* Increment the rotation counter...
STORE $('ABC',(@(ro:mastr,'ABC')+1)-3*INT((@(ro:mastr,'ABC')+1)/4),1);
TO ro:mastr
*
* Decrement the file counter, and redisplay number to be copied...
STORE t:count - 1 TO t:count
DO CASE
CASE t:count = 1
@ 10,25 SAY " There is 1 file to back up. "
CASE t:count > 1
@ 10,25 SAY "There are " +STR(t:count,1)+ " files to back up."
CASE t:count < 1
@ 10,25 SAY "There are NO files to back up."
ENDCASE
*
@ 15,24 SAY "************ DONE ************* "
@ 23,11 SAY "Remove the MASTER disk, "+;
"and press any key to continue..."
SET CONSOLE OFF
WAIT
SET CONSOLE ON
@ 15,24
@ 23,11
LOOP
ENDIF
*
*
IF bu:po
@ 15,19 SAY "Place PURCHASE ORDER disk '" + ro:po +;
"' in drive " + t:drive
@ 23,13 SAY "Press any key when ready, or RETURN to abort backup..."
STORE '?' TO t:select
@ 23,67 GET t:select
READ NOUPDATE
CLEAR GETS
*
* Branch to abort...
IF t:select = '?'
SAVE TO IN_rotat ALL LIKE ro:*
RELEASE ALL LIKE ro:*
RELEASE ALL LIKE t:*
RETURN
ENDIF
*
* Back it up...
@ 15,19
@ 15,25 SAY "Copying PURCHASE ORDER file..."
@ 23,13
USE IN_po
COPY TO &t:drive.IN_po
*
* Close the file...
USE
*
* Increment the rotation counter...
STORE $('ABC',(@(ro:po,'ABC')+1)-3*INT((@(ro:po,'ABC')+1)/4),1);
TO ro:po
*
STORE F TO bu:po
*
* Decrement the file counter, and redisplay number to be copied...
STORE t:count - 1 TO t:count
DO CASE
CASE t:count = 1
@ 10,25 SAY " There is 1 file to back up. "
CASE t:count > 1
@ 10,25 SAY "There are " +STR(t:count,1)+ " files to back up."
CASE t:count < 1
@ 10,25 SAY "There are NO files to back up."
ENDCASE
*
@ 15,24 SAY "************ DONE *************"
@ 23, 7 SAY "Remove the PURCHASE ORDER disk, "+;
"and press any key to continue..."
SET CONSOLE OFF
WAIT
SET CONSOLE ON
@ 15,24
@ 23, 7
LOOP
ENDIF
*
ENDDO
*
* EOF: Back_up.prg