Modifying Programs That Replace Files

Programs that replace files by erasing and rewriting them may be modified in any of several ways to avoid the previously-mentioned problems:
  • For the case where a temporary file is used, change the program to issue a COPYFILE command or the DMSFILEC routine (both with the REPLACE option) to copy the temporary file to the original file, and then erase the temporary file. The COPYFILE command and DMSFILEC routine preserve aliases and authorities of the output file.
  • For the simpler erase/rewrite scenario, change the erase to an FSOPEN with OPENTYP=REPLACE specified. This will work for both minidisk files and SFS files. Alternatively, you may change the program to use a temporary file and handle it as above, using COPYFILE with REPLACE.
  • Use the Shared File System routines for SFS output files, and use the macro interfaces for minidisk output files.
  • Do not use the program directly on shared output files. Copy the output files to temporary, private files. Run the program against the private files. Finally, copy the output files back to the actual files, using COPYFILE with REPLACE.