Re: tsunami question
- Posted by "George Walters" <gwalters at sc.rr.com> Dec 17, 2003
- 489 views
Ron, there was some interesting code (power basic) on the TRM website on this issue. ' Open the existing Tsunami file MultiUser& = %FALSE File$ = "C:\My Data\Customers.dat" hFile& = trm_Open(File$, MultiUser&) IF hFile& < 1 THEN Msg$ = "Error opening file:" + STR$(ABS(hFile&)) ' Display message ELSE ' File opened successfully ' Get it's File Definition string FileDef$ = trm_GetFileDef(hFile&) ' Close the file so it can be recreated Result& = trm_Close(hFile&) IF Result& THEN Msg$ = "Error closing file:" + STR$(Result&) ' Display message ELSE ' The file is closed... we can now recreate it using the ' file's original name and original File Definition string OverWrite& = %TRUE Result& = trm_Create(File$, FileDef$, OverWrite&) IF Result& THEN Msg$ = "Error recreating file:" + STR$(Result&) ' Display message ELSE ' File recreated successfully END IF END IF END IF ----- Original Message ----- From: "Ron Austin" <ronaustin at alltel.net> To: <EUforum at topica.com> Sent: Wednesday, December 17, 2003 1:26 PM Subject: RE: tsunami question > > > George Walters wrote: > > > > > > Ron, I understand the Create function, but using this you have do define > > all > > over again the characteristics of the file. I was hoping that a function > > existed that would simply clear the file and retain it's original > > characteristics. > > > > george > > > As far as I know, there is no "clear file". I have made an "init.exw > program for each of my files, for instance DiagInit.exw creates the > Diagnosis.dat file. There is one line to define the file, two lines to > create the two indexes and then the final line creates (or re-creates > the file). Since the init program had to be written to initally create > the file, all you have to do is run it again to clear the file, or as I > said earlier maybe it wood be good to put the procedure for creating all > the indexes in one include file and call them as needed. > ClearFile("Diagnosis.dat") or even CLearFile("Diagnosis") is all you > would need. Of course you would still have to be sure no one was using > the file when you cleared it. I imagine you are already doing that with > your present file system anyway. > > ----- Original Message ----- > > From: "Ron Austin" <ronaustin at alltel.net> > > To: <EUforum at topica.com> > > Sent: Wednesday, December 17, 2003 12:20 PM > > Subject: RE: tsunami question > > > > > > > George Walters wrote: > > > > > > > > > > > > I don't see a function to clear a tsunami file w/o deleteing it and > > > > recreating it. Did I over look this? I have a lot of files that are > > > > cleared > > > > at the end of the month or year as well as transaction files that need > > > > to be > > > > cleared after being posted. > > > > > > > > george > > > > when you create a file using trm_Create("my.dat",flag), if flag=1 then > > > > you can re-create and clear the file. If flag=0 and you try to recreate > > > > the file you get a warning message. If you used flag=1 then you could > > > > write an include file with procedure that would re-create and clear the > > > > file. You don't have to erase the file first. > > > > > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > > > > > > TOPICA - Start your own email discussion group. FREE! > >