Navigation: ABC Library Reference > FileManager > FileManager Methods >====== UseFile (use LazyOpen file) ====== | |
UseFile (usetype), PROC
UseFile | Notify other ABC objects that a file is getting ready to be used. |
usetype | A numeric constant, variable, EQUATE, or expression that determines how UseFile handles the file buffer. |
A value of UseType:Corrupts changes the value in the file buffer but does not rely on the new value. | |
A value of UseType:Uses changes the value of the file buffer and then uses that value. This is the default value. | |
A value of UseType:Returns holds a value from the file buffer to return it to the parent. This mode is useful if you have a form record split between two windows and need to preserve the values from one to the next. | |
A value of UseType:Benign indicates that no special file buffer handling is requested. | |
A value of UseType:Initialize indicates that the FileManager needs to be completely initialized, which includes the incrementing or decrementing of internal file counters. |
The UseFile method notifies ABC Library objects that the managed file whose opening was delayed by the LazyOpen property is about to be used. UseFile returns a value indicating whether the file is ready for use. A return value of Level:Benign indicates the file is ready; any other return value indicates a problem. UseFile should always be called before a file is opened.
Implementation:
UseFile return values are declared in ABERROR.INC. See Error Class for more information on these severity levels. The UseType EQUATEs are declared in ABFILE.INC as follows:
UseType ITEMIZE(1),PRE
Corrupts EQUATE
Uses EQUATE
Returns EQUATE
Benign EQUATE
Initialize EQUATE
END
Return Value: BYTE
Example:
FileManager.TryFetch PROCEDURE(KEY Key)
CODE
IF SELF.UseFile() THEN RETURN Level:Fatal. !really open the file
GET(SELF.File,Key)
IF ERRORCODE()
RETURN Level:Notify
ELSE
RETURN Level:Benign
END
See Also: LazyOpen