home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * Test program for SYSSAVE function - FILE T_SYSSAV.PRG
- *****************************************************************
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL choice := error_flag := file_types := mode := 1
- LOCAL clippath := '', filelist := {}
-
- INITGLOBAL()
- SETCOLOR(colstd)
-
- SET MESSAGE TO 24
-
- DO WHILE choice > 0 .AND. choice != 7
- CLEAR
- @ 3,34 SAY " MAIN MENU "
- @ 4,34 SAY " ▀▀▀▀▀▀▀▀▀▀▀ "
-
- * Menu below is for demonstration purposes only
- * Only option 6 (backup/restore) is functional
-
- @ 1, 10 TO 20, 70 DOUBLE
- @ 6,27 PROMPT " 1. File Maintenance " ;
- MESSAGE PADC("Maintenance for all system data files")
- @ 7,27 PROMPT " 2. System Reports " ;
- MESSAGE PADC("Menu of system reports")
- @ 8,27 PROMPT " 3. Utilities Menu " ;
- MESSAGE PADC("System setup and housekeeping Utilities")
- @ 9,27 PROMPT " 4. Daily Report Series " ;
- MESSAGE PADC("Special daily reports and procedures")
- @ 10,27 PROMPT " 5. End of Month Closing " ;
- MESSAGE PADC('Month end posting and report series')
- @ 11,27 PROMPT " 6. Data Backup or Restore " ;
- MESSAGE PADC("Data file backup/restore to/from A:")
- @ 14,27 PROMPT " ESC. -- EXIT SYSTEM " ;
- MESSAGE PADC("Return to DOS")
-
- * Display instructions and get operator's choice
- SETCOLOR(colwindow)
- @ 17,20 SAY " Select an option by moving the cursor, "
- @ 18,20 SAY " .. or pressing the appropriate number. "
- SETCOLOR(colstd)
-
- MENU TO choice
-
- DO CASE
-
- // CASE choice = ??
- // Other choices here
-
- CASE choice = 6
-
- * Set Clipper's path same as DOS path in case FORMAT
- * is needed. Assume that FORMAT.COM is on DOS path.
-
- clippath = GETE("PATH")
- SET PATH TO &clippath
-
- * Display available options
-
- @ 22, 16 SAY 'Select Operation: '
- @ 22, 36 PROMPT ' Backup files '
- @ 22, 52 PROMPT ' Restore files '
-
- mode = 1
- MENU TO mode
-
- IF mode = 1
- * More options for backup only
- @ 22, 16 SAY 'Select file group: '
- @ 22, 36 PROMPT ' Current files '
- @ 22, 52 PROMPT ' History files '
- file_types = 1
- MENU TO file_types
-
- * Create array of files for backup. Any file type
- * can be placed in the array, including compressed
- * or archived files. The TEMPn.TXT files below are
- * samples only. In this example, file names are
- * hard coded in the array. You can also load the
- * array with the Clipper DIRECTORY function.
-
- IF file_types = 1
- ASIZE(filelist, 6)
- filelist[1] = "TEMP1.TXT"
- filelist[2] = "TEMP2.TXT"
- filelist[3] = "TEMP3.TXT"
- filelist[4] = "TEMP4.TXT"
- filelist[5] = "TEMP5.TXT"
- filelist[6] = "TEMP6.TXT"
- ELSEIF file_types = 2
- ASIZE(filelist, 2)
- filelist[1] = "TEMP7.TXT"
- filelist[2] = "TEMP8.TXT"
- ELSE
- LOOP
- ENDIF
- ELSEIF mode = 0
- LOOP
- ENDIF
-
- * Call SYSSAVE to perform selected operation.
- * For this example, we are using single-line mode,
- * and we have hard-coded the backup drive as A.
-
- error_flag = SYSSAVE(mode + 2, "A", filelist)
-
- IF error_flag != 0
- * Error occurred, display its number
- ?? CHR(7)
- CENTERON(24, IF(mode = 1, 'Backup', 'Restore') + ;
- ' operation failed with error number '+ ;
- LTRIM(STR(error_flag)) )
-
- INKEY(0)
- ENDIF
-
- OTHERWISE
- IF choice != 0 .AND. choice != 7
- ERRORBEEP()
- CENTERON(24, 'Option not installed. ' + hitanykey)
- INKEY(0)
- ENDIF
- ENDCASE
- ENDDO
-
- CLEAR
- RETURN
-
-