errorsysw.prg

Post Reply
User avatar
TimStone
Posts: 2955
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

errorsysw.prg

Post by TimStone »

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


  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
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: errorsysw.prg

Post by nageswaragunupudi »

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

You need to include "dbinfo.ch"
Regards

G. N. Rao.
Hyderabad, India
User avatar
TimStone
Posts: 2955
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: errorsysw.prg

Post by TimStone »

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
Post Reply