%META:TOPICINFO{author="ChrisBartram" date="1170386103" format="1.1" version="1.2"}% %META:TOPICPARENT{name="Hp3000ProgrammingFeatures"}% ---+ [[Hp3000PurgeLargeFile][Purging a large file on an HP3000]] When the MPE/XL machines came out, HP changed the :PURGE command to first "wipe out" the file, effectively "shredding" the contents so that even low-level tools could not recreate its contents. (I believe this was in response to a DoD requirement.) For large files, this can take a long time. However, by first removing write access to the file, the :PURGE command cannot write to the file, but the file is deleted anyway! The following command file shows how this works.
   PARM filename="?"
   if  "!filename" = "?"
      echo Function: Purge a large file quickly
      echo Syntax  : PURGEQ filename
      echo Parm    : filename  -  the name of the file to be purged
      echo Example : PURGEQ BIGFILE
      echo
      return
   endif
   FILE X = !filename, OLD; ACC=IN
   if finfo( "*X", "exists" )
      PURGE *X
   else
      PURGE !filename
   endif
   RESET X
The ",OLD" designation is used on the :FILE equation so that "finfo" will not acknowledge a temporary file of the same name. The "ACC=IN" is what removes write access. If the file does not exist, we want :PURGE to return the appropriate error message without reference to file "X". No doubt other enhancements are possible, but this gets the idea across. Incidentally, temporary files are not affected by the "long purge." --[[GlennCole]] -- Main.ChrisBartram - 09 Jun 2006