Init (initialize the FileManager object)

Top  Previous  Next

 

Init( file, error handler ), VIRTUAL

Init

Initializes the FileManager object.

File

The label of the managed file.

error handler

The label of an ErrorClass object. See Error Class for more information.

The Init method initializes the FileManager object.

Implementation:

The Init method does not initialize some file specific properties (Buffer, FileName, and FileNameValue). You should explicitly initialize these properties after the Init method is called (or within your derived Init method). See the Conceptual Example.

Example:

PROGRAM

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

MAP                              !program map

END

 

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),CREATE,BINDABLE,THREAD

IDKey      KEY(CLI:ID),NOCASE,OPT,PRIMARY

Record     RECORD,PRE()

ID          LONG

Name        STRING(20)

StateCode   STRING(2)

          END

         END

CODE

GlobalErrors.Init              !initialize the GlobalErrors object

Access:Client.Init             !initialize Access:Client object

!program code

Access:Client.Kill             !shut down the Access:Client object

GlobalErrors.Kill              !shut down the GlobalErrors object

 

Access:Client.Init  PROCEDURE

CODE

PARENT.Init(Client, GlobalErrors)     !call the base class Init method

SELF.FileNameValue = 'Client'         !set the file name

SELF.Buffer &= CLI:Record             !point Access:Client to Client buffer

SELF.AddKey(CLI:IDKey,'Client ID',1)  !describe the primary key

See Also:     Buffer, File, FileName, FileNameValue