*数据备份子程序
*程序名: BF
*开发日期: 95,8,10
*程序员:
*变量说明
*QDQ:选择驱动器
*ERR:接收错误信息
*DD:用于等待的伪变量
*TC:是否退出
*SCR1:存屏
*YYHQDQ:原隐含驱动器
*CPXYRL:磁盘剩余容量
*ESC1:READ时未修改按ESC键退出的READKEY值
*ESC2:READ时修改后按ESC键退出的READKEY值
*PS:磁盘盘数
*BBFILE:备份文件名
*JSQ:计数器
*XL:虚拟变量(无意义)
PRIVATE ALL except p_*
do jrz with p_gzrrxm,'进入备份数据'
TC=.F.
ERR=0
DIMENSION BBFILE(99)
JSQ=1
XL=' '
DO WHILE JSQ IF JSQ BBFILE(JSQ)='BB.00'+STR(JSQ,1)
ELSE
BBFILE(JSQ)='BB.0'+STR(JSQ,2)
ENDIF
JSQ=JSQ+1
ENDDO
#DEFINE ESC1=12
#DEFINE ESC2=268
=CAPSLOCK(.T.)
DO WHILE .T.
DO WHILE .T.
*确认和检测软盘
QDQ=1
DO FORM XZQDQ NAME XZQDQ
*SET COLOR TO
ON ERROR ERR=ERROR()
SAVE SCREEN TO SCR1
DO WHILE .T.
DO CASE
CASE QDQ=1
SET DEFAULT TO A:
CASE QDQ=2
SET DEFAULT TO B:
OTHERWISE
TC=.T.
EXIT
ENDCASE
CPXYRL=DISKSPACE()
EXIT
ENDDO
*驱动器没准备好的处理
IF ERR#0
QD=.T.
DHXX=IIF(QDQ=1,'A','B')+'软盘没有准备好或软盘损坏, 请检查!'+CHR(13)+;
'是否重试?'
DO FORM SFDHK
IF .NOT. QD
TC=.T.
EXIT
ENDIF
ERR=0
ELSE
EXIT
ENDIF
ENDDO
SET DEFAULT TO &P_CXLJ
ON ERROR
IF TC
EXIT
ENDIF
*利用ARJ在硬盘上生成数据
! ARJ U -Y -V1200 BB.001 *.DBF *.?DX *.MEM
*检测数据有几张盘
PS=1
DO WHILE .T.
IF FILE(BBFILE(PS))
PS=PS+1
ELSE
EXIT
ENDIF
ENDDO
DHXX='本次备份需要'+STR(PS-1,2)+'张盘.'
DO FORM DHK
*SET COLOR TO
JSQ=1
XZ=1
DO CASE
CASE QDQ=1
SET DEFAULT TO A:
DO WHILE JSQ *检测磁盘容量和盘正确以否
SET DEFAULT TO A:
IF JSQ>1
DHXX='请放第'+STR(JSQ,2)+'张盘.'
DO FORM &P_CXLJ.\DHK
ENDIF
QD=.T.
DO WHILE .T.
IF FILE(BBFILE(JSQ))
DELETE FILE BBFILE(JSQ)
ENDIF
IF DISKSPACE() SET DEFAULT TO &P_CXLJ
DHXX='磁盘放错,是否换盘重试?'
do form sfdhk
SET DEFAULT TO A:
IF qd
LOOP
ELSE
EXIT
ENDIF
ENDIF
EXIT
ENDDO
IF .not. qd
EXIT
ENDIF
DELETE FILE BBFILE(JSQ)
SET DEFAULT TO &P_CXLJ
BFFILE=BBFILE(JSQ)
dhxx1='正在备份数据, 请稍候...'
do form xxts name xxts
COPY FILE &BFFILE TO A:\&BFFILE
DELE FILE &BBFILE
xxts.release
JSQ=JSQ+1
IF TC
EXIT
ENDIF
ENDDO
CASE QDQ=2
SET DEFAULT TO B:
DO WHILE JSQ *检测磁盘容量和盘正确以否
SET DEFAULT TO B:
IF JSQ>1
DHXX='请放第'+STR(JSQ,2)+'张盘.'
DO FORM &P_CXLJ.\DHK
ENDIF
QD=.T.
DO WHILE .T.
IF FILE(BBFILE(JSQ))
DELETE FILE BBFILE(JSQ)
ENDIF
IF DISKSPACE() SET DEFAULT TO &P_CXLJ
DHXX='磁盘放错,是否换盘重试?'
do form sfdhk
SET DEFAULT TO B:
IF qd
LOOP
ELSE
EXIT
ENDIF
ENDIF
EXIT
ENDDO
IF .not. qd
EXIT
ENDIF
DELETE FILE BBFILE(JSQ)
SET DEFAULT TO &P_CXLJ
BFFILE=BBFILE(JSQ)
dhxx1='正在备份数据, 请稍候...'
do form xxts name xxts
COPY FILE &BFFILE TO B:\&BFFILE
DELE FILE &BBFILE
xxts.release
JSQ=JSQ+1
IF TC
EXIT
ENDIF
ENDDO
ENDCASE
IF XZ=2
EXIT
ENDIF
WAIT WINDOW '备份完毕!' NOWAIT
EXIT
ENDDO
DEACTIVATE WINDOW BF
DELETE FILE BB.*
#UNDEFINE ESC1
#UNDEFINE ESC2
SET DEFAULT TO &P_CXLJ
do jrz with p_gzrrxm,'退出备份数据'
RETURN