RE: tsunami question
- Posted by Ron Austin <ronaustin at alltel.net> Dec 17, 2003
- 484 views
That's interesting George, but I believe it assumes you are using the "String based API" and Euman used the "Pointer based API #1". I don't think there is a way of passing a filedef when creating the file with the pointer base api. string API: result= trmCreate(file$,FileDef$,OverWrite) pointer API: result= trmCreate(file,OverWrite) pointer based assumes the filedef has already been defined. Maybe Euman will have a different answer, but that's the way I see it. George Walters wrote: > > > 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. > > > > > <snip>