Dec 072017
 
Nice Clipper Backup/Restore function that includes source code.
File PER.ZIP from The Programmer’s Corner in
Category Dbase Source Code
Nice Clipper Backup/Restore function that includes source code.
File Name File Size Zip Size Zip Type
PER_BACK.PRG 11979 3180 deflated
PER_BACK.TXT 2417 1216 deflated
PER_REST.PRG 10742 2922 deflated

Download File PER.ZIP Here

Contents of the PER_BACK.TXT file


BACKUP AND RESTORE FILES FROM WITHIN CLIPPER

by: Per Kjellqvist, HotSoft, Geneva, Switzerland - CS User ID 71540,2311



The common approach to data backup is to simply state in the manual that
all data has to be backed up using either the DOS backup function, or a
backup program such as FastBack. However, my experience has shown me that
very few users follow this tip.

I think that for a database application to be complete it must include
routines to backup and restore datafiles filling more than one floppy disk.

To solve this problem I started by searching the good old NANFORUM to see
if anyone had already written a good Clipper backup utility. All I found
was a demo program that was bigger than 100 Kb. Living in Europe I decided
100 Kb was to expensive for just a demo, so I set out to write the program
myself.

I figured out a fairly simple solution using the low level file commands, and
included you will find the two programs:

PER_BACK.PRG -> The backup routine
PER_REST.PRG -> The restore routine

If you like the programs you are free to use them in your applications, but
if you are to include them in a commercial application please send me a line
or two (it is always good to know if your work is appreciated or not).

The method I use very simple but not as elaborate as commercial backup
programs.

To back up files you first define the files using wildcards. The names
are read into an array, and the total size in bytes is calculated. The next
step is to copy the files one by one in increments of 1024 bytes (this can
be made bigger or smaller depending on how much memory you want to use for
the buffer) I found the size of this buffer does not really change the speed
much. Once a disk is full the program prompts for a new one, and continues
with the current file where it left off. On each disk I also place a .mem
file with the number of the disk, a unique number for the backup set, and
the total amount of bytes copied in the set.

The recovery works almost the same way but the other way around.

I have also included a few turnkey checks. The program makes sure you don't
put the same disk in twice during the backup, and when recovering it checks
to see that all disks belong to the same set, that the number is correct, and
that it really is a backup disk.

I hope you find these programs useful.


 December 7, 2017  Add comments

Leave a Reply