Most Efficient File Handling to Empty and Import 2 files

I meant to define a FILE using the Clarion DOS File Driver. Use that DOS file to OPEN(,DenyAll+ReadOnly) your TPS file by setting the NAME() variable. You will have to have the TPS file closed.

OpenThisFile        FILE,DRIVER('DOS'),NAME(OpenThisFileName),PRE(OpenA)
Record                  RECORD,PRE()
Block                      STRING(1024)   !OpenA:Block
                       END
                    END
...
   CLOSE(OpenThisFile)  
   OpenThisFileName = NAME(TpsFileofYours)
   CLOSE(TpsFileofYours)
   OPEN(OpenThisFile,ReadOnly + DenyALL)
   IF ERRORCODE() THEN
      Message('Cannot import the File XYZ is in use.','import')
...

I wrote this little utility that allows opening any File using any Modes so I could test my code error handling of locked files. This uses a DOS file to do the Open. Look at this source.

1 Like