GetName (return the filename)

Top  Previous  Next

 

GetName

The GetName method returns the filename of the managed file for display in error messages, etc.

The SetName method sets the (variable) filename of the managed file.

Implementation:

GetName returns the value of the FileNameValue property if it has a value; otherwise, it returns the value of the FileName property.

Return Data Type:     STRING

Example:

PROGRAM

INCLUDE('ABFILE.INC')                   !declare FileManager class

MAP                                     !program map

LogError   (STRING filename, SHORT error)!prototype LogError procedure

END

 

GlobalErrors ErrorClass                  !declare GlobalErrors object

Access:Client CLASS(FileManager)         !derive Access:Client object

             END

ErrorLog   FILE,DRIVER(‘TopSpeed’),PRE(LOG),CREATE,THREAD!declare log file

Record      RECORD

Date         LONG

Time         LONG

File         STRING(20)

ErrorId      SHORT

           END

          END

CODE

!program code

IF Access:Client.Open()           !if error occurs

 LogError(Access:Client.GetName(),Access:Client.GetError())!log name/error id

END

!program code

 

LogError PROCEDURE(STRING filename, SHORT error)

CODE

LOG:Date   = TODAY()            !store date

LOG:Time   = CLOCK()            !store time

LOG:File   = filename           !store filename

LOG:ErrorId = error             !store error id

ADD(ErrorLog)                   !write logfile

See Also:

FileName, FileNameValue, SetName