FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour errorsysw.prg
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
errorsysw.prg
Posted: Tue Jan 29, 2019 11:43 PM
When I open files ( tDatabase via tData ) I assign a default alias. Of course, we open the file using the filename. The default alias ( calculated ) allows us to open the same file different times without a problem.

When working with errorsysw, we have the following code to list dbf files:

Code (fw): Select all Collapse
  cErrorLog += CRLF + "DataBases in use" + CRLF + "================" +  CRLF
   for n = 1 to 255
      if ! Empty( Alias( n ) )
         // cErrorLog += (Alias(n))->( cFile ) + CRLF
         cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n,"=> ", "   " ) + ;
                      PadR( Alias( n ), 15 ) + Space( 20 ) + "RddName: " + ;
                      ( Alias( n ) )->( RddName() ) + CRLF
         cErrorLog += "     ==============================" + CRLF
         cErrorLog += "     RecNo    RecCount    BOF   EOF" + CRLF
         cErrorLog += "    " + Transform( ( Alias( n ) )->( RecNo() ), "9999999" ) + ;
                      "      " + Transform( ( Alias( n ) )->( RecCount() ), "9999999" ) + ;
                      "      " + cValToChar( ( Alias( n ) )->( BoF() ) ) + ;
                      "   " + cValToChar( ( Alias( n ) )->( EoF() ) ) + CRLF + CRLF


Because the default ( generated ) Alias is random, it does not help me identify the involved dbf on the error log. We not only pass the cAlias but we also pass cFile ( the file name that is actually opened ). I would like to include the actual file name, but can't seem to find a way to pull it out in this situation.

Note the commented line in the code. That forces the error program to quit without displaying anything.

Any suggestions will be greatly appreciated.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: errorsysw.prg
Posted: Wed Jan 30, 2019 03:32 AM

( cAlias )->( DBINFO( DBI_FULLPATH ) ) --> cFileName

You need to include "dbinfo.ch"

Regards



G. N. Rao.

Hyderabad, India
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: errorsysw.prg
Posted: Wed Jan 30, 2019 06:54 PM

Thank you. That works perfectly.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit

Continue the discussion