NETERR() Determine if a network command has failed ------------------------------------------------------------------------------ Syntax NETERR([<lNewError>]) --> lError Arguments <lNewError>, if specified, sets the value returned by NETERR() to the specified status. <lNewError> can be either true (.T.) or false (.F.). Setting NETERR() to a specified value allows the runtime error handler to control the way certain file errors are handled. For more information, refer to Errorsys.prg. Returns NETERR() returns true (.T.) if a USE or APPEND BLANK fails. The initial value of NETERR() is false (.F.). If the current process is not running under a network operating system, NETERR() always returns false (.F.). Description NETERR() is a network function. It is a global flag set by USE, USE...EXCLUSIVE, and APPEND BLANK in a network environment. It is used to test whether any of these commands have failed by returning true (.T.) in the following situations: NETERR() Causes ------------------------------------------------------------------------ Command Cause ------------------------------------------------------------------------ USE USE EXCLUSIVE by another process USE...EXCLUSIVE USE EXCLUSIVE or USE by another process APPEND BLANK FLOCK() or RLOCK() of LASTREC() + 1 by another user ------------------------------------------------------------------------ NETERR() is generally applied in a program by testing it following a USE or APPEND BLANK command. If it returns false (.F.), you can perform the next operation. If the command is USE, you can open index files. If it is APPEND BLANK, you can assign values to the new record with a REPLACE or @...GET command. Otherwise, you must handle the error by either retrying the USE or APPEND BLANK, or terminating the current operation with a BREAK or RETURN. Examples . This example demonstrates typical usage of NETERR(). If the USE succeeds, the index files are opened and processing continues. If the USE fails, a message displays and control returns to the nearest BEGIN SEQUENCE construct: USE Customer SHARED NEW IF !NETERR() SET INDEX TO CustNum, CustOrders, CustZip ELSE ? "File is in use by another" BREAK ENDIF Files Library is CLIPPER.LIB.
See Also: APPEND BLANK RLOCK()
Pingback: C5 Error Class | Viva Clipper !
Pingback: C5_USE | Viva Clipper !