errorsysw.prg

errorsysw.prg

Postby TimStone » 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: Select all  Expand view  RUN

  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
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: errorsysw.prg

Postby nageswaragunupudi » Wed Jan 30, 2019 3:32 am

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

You need to include "dbinfo.ch"
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: errorsysw.prg

Postby TimStone » Wed Jan 30, 2019 6: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
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests