Navigation: ABC Library Reference > FileManager > FileManager Methods >====== SetName (set current filename) ====== | |
SetName( filename )
SetName | Sets the variable filename of the managed file. |
filename | A string constant, variable, EQUATE, or expression that contains the filename of the managed file. |
The SetName method sets the variable filename (NAME attribute) of the managed file. This value determines which file is actually opened and processed by the FileManager object. The filename is also displayed in error messages, etc.
The GetName method returns the name of the managed file.
Implementation:
SetName assumes the FileName property is a reference to the file's NAME attribute variable.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP
END !program map
ClientFile STRING(8) !client filename variable
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager)!derive Access:Client object
Init PROCEDURE !initialize Access:File object
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),THREAD,NAME(CLientFile)
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
CODE
GlobalErrors.Init !initialize the GlobalErrors object
Access:Client.Init !initialize the Access:Client object
LOOP I# = 1 TO 12 !step through 12 monthly files
Access:Client.SetName('Client'&I#) !set the filename variable
Access:Client.Open !open the monthly file
!process the file
Access:Client.Close !close the monthly file
END
Access:Client.Init PROCEDURE
CODE
PARENT.Init(GlobalErrors) !call the base class Init method
SELF.File &= Client !point Access:Client to Client file
SELF.Buffer &= CLI:Record !point Access:Client to Client buffer
SELF.FileName &= ClientFile !point Access:Client to filename variable
See Also: FileName, FileNameValue, GetName