DECLARE SUB filelist (file$) DECLARE SUB fileexist (file$, yn$) DECLARE SUB filemkdir (destdir$) DECLARE SUB fileopenout (destdir$, basename$, ext$, filename$, ok$) DECLARE SUB fileprnt (file$) DECLARE SUB fileprot (file$) '**************************************************************************** 'Module FILE 'This module contains file management utility subroutines. ' 'Zachary Wolf '6/3/94 '**************************************************************************** SUB fileexist (file$, yn$) '**************************************************************************** 'This subroutine checks to see if a given file exists. ' 'Input: ' file$, the file we are checking on ' 'Output: ' yn$, "y" if the file exists, "n" if it doesn't ' 'Zachary Wolf '5/28/94 '**************************************************************************** 'See if file$ exists check$ = DIR$(file$) 'Return "y" or "n" yn$ = "y" IF check$ = "" THEN yn$ = "n" END SUB SUB fileheader (logfile$, project$, magtype$, magname$, barcode$, teststand$, coilname$, operator$, run$, comment$) '**************************************************************************** 'This subroutine writes the header of a log file. ' 'Input: ' logfile$, name, including the path, of the log file ' project$, name of the project ' magtype$, magnet type ' magname$, name of magnet (serial #) ' barcode$, barcode number on the magnet ' teststand$, the teststand being used ' coilname$, the ID of the measurement coil ' operator$, name of the operator doing the test ' run$, run number ' comment$, comment about the test ' 'Zachary Wolf '6/4/94, 1/19/95, 9/19/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print a general header PRINT #filenum%, "SLAC Magnetic Measurements" PRINT #filenum%, "Date: "; DATE$ PRINT #filenum%, "Time: "; TIME$ PRINT #filenum%, 'Print the magnet test parameters to the log file PRINT #filenum%, "Project: "; project$ PRINT #filenum%, "Magnet Type: "; magtype$ PRINT #filenum%, "Magnet Name (Serial #): "; magname$ PRINT #filenum%, "Bar Code Number: "; barcode$ PRINT #filenum%, "Test Stand: "; teststand$ PRINT #filenum%, "Measurement System: "; coilname$ PRINT #filenum%, "Operator: "; operator$ PRINT #filenum%, "Run Number: "; run$ PRINT #filenum%, "Comment: "; comment$ 'Close the log file CLOSE filenum% END SUB SUB fileheadera (logfile$, project$, magtype$, magname$, coilname$, operator$, run$, comment$) '**************************************************************************** 'This subroutine writes the header of a log file. ' 'Input: ' logfile$, name, including the path, of the log file ' project$, name of the project ' magtype$, magnet type ' magname$, name of magnet (serial #) ' coilname$, the ID of the measurement coil ' operator$, name of the operator doing the test ' run$, run number ' comment$, comment about the test ' 'Zachary Wolf '6/4/94, 1/19/95, 9/19/95, 7/11/96 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Print a general header PRINT #filenum%, "SLAC Magnetic Measurements" PRINT #filenum%, "Date: "; DATE$ PRINT #filenum%, "Time: "; TIME$ PRINT #filenum%, 'Print the magnet test parameters to the log file PRINT #filenum%, "Project: "; project$ PRINT #filenum%, "Magnet Type: "; magtype$ PRINT #filenum%, "Magnet Name (Serial #): "; magname$ PRINT #filenum%, "Measurement System: "; coilname$ PRINT #filenum%, "Operator: "; operator$ PRINT #filenum%, "Run Number: "; run$ PRINT #filenum%, "Comment: "; comment$ 'Close the log file CLOSE filenum% END SUB SUB fileinit (project$, magname$, run$, logfile$, rawfile$, datfile$, pltfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' rawfile$, path and name of the raw data file ' datfile$, path and name of the data file ' pltfile$, path and name of the plot file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "logfile", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'RAW DATA FILE 'Initialize the raw data file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rawfile", ext$, rawfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "datfile", ext$, datfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Make a .bat file to write protect the data CALL fileprot(datfile$) 'Make a .bat file to print the dat file CALL fileprnt(datfile$) 'PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "pltfile", ext$, pltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Make a .bat file to write protect the data CALL fileprot(pltfile$) 'If we made it this far, things are ok ok$ = "y" pblmexit: END SUB SUB fileinitcoil (project$, magtype$, magname$, run$, logfile$, strdatfile$, hardatfile$, strpltfile$, harpltfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magtype$, magnet type ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' strdatfile$, path and name of the magnet strength data file ' hardatfile$, path and name of the magnet harmonics data file ' strpltfile$, path and name of the magnet strength plot file ' harpltfile$, path and name of the magnet harmonics plot file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "bllog", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitbln 'MAGNET STRENGTH DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "blstrdat", ext$, strdatfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitbln 'Make a .bat file to write protect the data CALL fileprot(strdatfile$) 'Make a .bat file to print the dat file CALL fileprnt(strdatfile$) 'HARMONICS DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "blhardat", ext$, hardatfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitbln 'Make a .bat file to write protect the data CALL fileprot(hardatfile$) 'Make a .bat file to print the dat file CALL fileprnt(hardatfile$) 'MAGNET STRENGTH PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "blstrplt", ext$, strpltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitbln 'Make a .bat file to write protect the data CALL fileprot(strpltfile$) 'HARMONICS PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "blharplt", ext$, harpltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitbln 'Make a .bat file to write protect the data CALL fileprot(harpltfile$) 'If we made it this far, things are ok ok$ = "y" pblmexitbln: END SUB SUB fileinithh (project$, magtype$, magname$, run$, logfile$, datfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magtype$, magnet type ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' datfile$, path and name of the data file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '9/12/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "hhlog", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexithh 'DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "hhdat", ext$, datfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexithh 'Make a .bat file to write protect the data CALL fileprot(datfile$) 'Make a .bat file to print the dat file CALL fileprnt(datfile$) 'Add the dat file to the list of all data files CALL filelist(datfile$) 'If we made it this far, things are ok ok$ = "y" pblmexithh: END SUB SUB fileinitlog (logfile$) '**************************************************************************** 'This subroutine initializes the log file. ' 'Output: ' logfile$, path and name of the log file ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize the log file filenum% = FREEFILE logfile$ = "logfile.dat" OPEN logfile$ FOR OUTPUT AS filenum% 'Close the file CLOSE filenum% END SUB SUB fileinitmap (project$, magtype$, magname$, run$, logfile$, datfile$, pltfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magtype$, magnet type ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' datfile$, path and name of the data file ' pltfile$, path and name of the plot file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "maplog", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitmap 'DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "mapdat", ext$, datfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitmap 'Make a .bat file to write protect the data CALL fileprot(datfile$) 'Make a .bat file to print the dat file CALL fileprnt(datfile$) 'PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "mapplt", ext$, pltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitmap 'Make a .bat file to write protect the data CALL fileprot(pltfile$) 'If we made it this far, things are ok ok$ = "y" pblmexitmap: END SUB SUB fileinitrt (project$, magtype$, magname$, run$, logfile$, datfile$, pltfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magtype$, magnet type ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' datfile$, path and name of the data file ' pltfile$, path and name of the plot file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rtlog", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitrt 'DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rtdat", ext$, datfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitrt 'Make a .bat file to write protect the data CALL fileprot(datfile$) 'Make a .bat file to print the dat file CALL fileprnt(datfile$) 'PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rtplt", ext$, pltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitrt 'Make a .bat file to write protect the data CALL fileprot(pltfile$) 'If we made it this far, things are ok ok$ = "y" pblmexitrt: END SUB SUB fileinitwire (project$, magtype$, magname$, run$, logfile$, datfile$, pltfile$, ok$) '**************************************************************************** 'This subroutine initializes all files. ' 'Input: ' project$, project name ' magtype$, magnet type ' magname$, magnet name ' run$, run number ' 'Output: ' logfile$, path and name of the log file ' datfile$, path and name of the data file ' pltfile$, path and name of the plot file ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '7/26/95 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the file subdir$ = "c:\magdata\" + LEFT$(project$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) CALL filemkdir(subdir$) subdir$ = "c:\magdata\" + LEFT$(project$, 8) + "\" + LEFT$(magtype$, 8) + "\" + LEFT$(magname$, 8) CALL filemkdir(subdir$) 'Form the extension for the file r% = VAL(run$) IF r% < 10 THEN ext$ = "ru" + run$ IF r% >= 10 THEN ext$ = "r" + run$ 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "wirelog", ext$, logfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitwire 'DATA FILE 'Initialize the dat file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "wiredat", ext$, datfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitwire 'Make a .bat file to write protect the data CALL fileprot(datfile$) 'Make a .bat file to print the dat file CALL fileprnt(datfile$) 'PLOT FILE 'Initialize the plt file 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "wireplt", ext$, pltfile$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexitwire 'Make a .bat file to write protect the data CALL fileprot(pltfile$) 'If we made it this far, things are ok ok$ = "y" pblmexitwire: END SUB SUB fileisat (logfile$, isat!) '**************************************************************************** 'This subroutine writes the standardizations currents to the header 'of a log file. ' 'Input: ' logfile$, name, including the path, of the log file ' isat!, the saturation current ' 'Zachary Wolf '9/22/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the currents to the log file PRINT #filenum%, PRINT #filenum%, "Saturation Current" PRINT #filenum%, "The current was initially run to "; isat!; " A." 'Close the log file CLOSE filenum% END SUB SUB fileistand (logfile$, n%, istand!) '**************************************************************************** 'This subroutine writes the standardizations currents to the header 'of a log file. ' 'Input: ' logfile$, name, including the path, of the log file ' n%, number of standardization cycles ' istand!, the standardization current ' 'Zachary Wolf '9/22/95 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the currents to the log file PRINT #filenum%, PRINT #filenum%, "Standardization Currents" IF istand! > 0 THEN PRINT #filenum%, n%; " cycles, 0 to "; istand!; " to 0 A" ELSE PRINT #filenum%, n%; " cycles, 0 to "; ABS(istand!); " to 0 to "; istand!; " to 0 A" END IF 'Close the log file CLOSE filenum% END SUB SUB fileitest (logfile$, n%, imag!()) '**************************************************************************** 'This subroutine writes the test currents to the header of a log file. ' 'Input: ' logfile$, name, including the path, of the log file ' n%, number of currents ' imag!(1 to n%), the magnet currents ' 'Zachary Wolf '4/16/94, 6/3/94, 8/14/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN logfile$ FOR APPEND AS filenum% 'Write the currents to the log file PRINT #filenum%, PRINT #filenum%, "Test Currents" FOR i% = 1 TO n% STEP 7 FOR j% = 0 TO 6 IF i% + j% > n% THEN EXIT FOR PRINT #filenum%, USING " #####.#"; imag!(i% + j%); NEXT j% PRINT #filenum%, NEXT i% 'Close the log file CLOSE filenum% END SUB SUB filelist (file$) '**************************************************************************** 'This subroutine adds the input file name to filelist.dat, the list of 'all (data) files. filelist.dat must already exist. This subroutine 'only appends to it. ' 'Input: ' file$, name of the file to add to the list ' 'Zachary Wolf '5/14/94, 6/3/94, 7/17/96 '**************************************************************************** 'Open the list file filenum% = FREEFILE OPEN "filelist.dat" FOR APPEND AS filenum% 'Add file$ to the end of the list PRINT #filenum%, file$ 'Close the list file CLOSE filenum% END SUB SUB filemkdir (destdir$) '**************************************************************************** 'This subroutine comes from the examples in HELP under MKDIR. It checks 'to see if the directory already exists. If it doesn't, it creates the 'directory. ' 'Input: ' DestDir$, the name, including the path, of the new directory you wish to make ' 'Zachary Wolf '6/4/94 '**************************************************************************** ON LOCAL ERROR GOTO errhandler 'Set up the local error handler. CurDirName$ = CURDIR$ 'Preserve the name of the current directory. CHDIR destdir$ 'Change to DestDir$ - Error 76 if not exist. PRINT : PRINT "Directory "; destdir$; " already exists." madedir: CHDIR CurDirName$ 'Change back to original directory. EXIT SUB errhandler: IF ERR = 76 THEN MKDIR destdir$ 'Make the directory. PRINT : PRINT "Directory "; destdir$; " created." RESUME madedir: END IF RESUME NEXT END SUB SUB filenewpage (filename$) '**************************************************************************** 'This subroutine writes a page break character to a file. ' 'Inputs: ' filename$, the name of the file ' 'Zachary Wolf '8/20/94 '**************************************************************************** 'Open the log file filenum% = FREEFILE OPEN filename$ FOR APPEND AS filenum% 'Write a page break character PRINT #filenum%, CHR$(12) 'Close the log file CLOSE filenum% END SUB SUB fileopenout (destdir$, basename$, ext$, filename$, ok$) '**************************************************************************** 'This subroutine opens a file in the specified directory with the 'specified base name and extension. Any problems opening the file are 'flagged. ' 'Input: ' destdir$, destination directory ' basename$, base name of file ' ext$, file extension ' 'Output: ' filename$, the complete file name, including the path, of the created file ' ok$, "y" if ok, "n" otherwise ' 'Zachary Wolf '8/14/94 '**************************************************************************** 'Initialize ok$ = "n" 'Set up the local error handler ON LOCAL ERROR GOTO errhandle 'Name the file IF destdir$ = "" OR destdir$ = "." THEN filename$ = basename$ + "." + ext$ ELSE filename$ = destdir$ + "\" + basename$ + "." + ext$ END IF 'Check to see if filename$ already exists CALL fileexist(filename$, yn$) 'If filename$ already exists return IF yn$ = "y" THEN GOTO notok 'Open the file filenum% = FREEFILE OPEN filename$ FOR OUTPUT AS filenum% 'Close the file CLOSE filenum% 'Message PRINT "File " + filename$ + " created." 'If we made it here, things went ok ok$ = "y" notok: EXIT SUB errhandle: RESUME notok END SUB SUB fileplot (file$, epfile$) '**************************************************************************** 'This subroutine makes a .bat file which is used to plot the input file. ' 'Input: ' file$, the name of the file the .bat file will plot ' epfile$, the EasyPlot batch file name to format the plot ' 'Zachary Wolf '5/14/94, 6/4/94, 8/14/94 '**************************************************************************** 'Initialize STATIC ncall% ncall% = ncall% + 1 'Open the .bat file 'On the first call, overwrite any existing fileplot.bat filenum% = FREEFILE IF ncall% = 1 THEN OPEN "fileplot.bat" FOR OUTPUT AS filenum% ELSE OPEN "fileplot.bat" FOR APPEND AS filenum% END IF 'Copy the input file to the current directory and give it a standard name PRINT #filenum%, "copy "; file$; " plot.dat" 'Run the plotting program PRINT #filenum%, "c:\easyplot\ep "; epfile$ 'Delete the tempory plotting file PRINT #filenum%, "del plot.dat" 'Close the log file CLOSE filenum% END SUB SUB fileprnt (file$) '**************************************************************************** 'This subroutine makes a .bat file which is used to print input files. ' 'Input: ' file$, input file for the .bat file to print ' 'Zachary Wolf '5/14/94, 6/3/94 '**************************************************************************** 'Initialize STATIC ncall% ncall% = ncall% + 1 'Open the .bat file 'On the first call overwrite any existing fileprnt.bat filenum% = FREEFILE IF ncall% = 1 THEN OPEN "fileprnt.bat" FOR OUTPUT AS filenum% ELSE OPEN "fileprnt.bat" FOR APPEND AS filenum% END IF 'Print the input file PRINT #filenum%, "call lprint "; file$ 'Close the .bat file CLOSE filenum% END SUB SUB fileprot (file$) '**************************************************************************** 'This subroutine makes a .bat file which is used to set the attributes 'of a file so it can not be written over. ' 'Input: ' file$, name of the file to make read only ' 'Zachary Wolf '5/14/94, 6/3/94 '**************************************************************************** 'Initialize STATIC ncall% ncall% = ncall% + 1 'Open the .bat file 'On the first call, overwrite an existing fileprot.bat filenum% = FREEFILE IF ncall% = 1 THEN OPEN "fileprot.bat" FOR OUTPUT AS filenum% ELSE OPEN "fileprot.bat" FOR APPEND AS filenum% END IF 'Make the input file read only PRINT #filenum%, "attrib +r "; file$ 'Close the .bat file CLOSE filenum% END SUB