Exists
Exists(filename$)
The exists internal function returns a nonzero value if the specified file exists and the user has read privileges. If one or both of these conditions is false, exists returns a value of zero. NOTE that on single-user systems, all files have read privileges for the current user.
The exists function returns:
- a value of 1 for directories
- a number greater than 1 for files
Comments and Examples
Future |
---|
Future releases of Business Rules! may return the file type (e.g., 4 for internal, 9/10/11 for programs). |
For the present, do not test for any specific positive value. Only zero or non-zero tests should be used. Recommended coding practices for programs are:
00010 IF EXISTS("filename") THEN GOTO FOUND 00020 IF EXISTS("filename") <> 0 THEN GOTO FOUND 00030 IF NOT EXISTS("filename") THEN GOTO NOTFOUND 00040 IF EXISTS("filename") = 0 THEN GOTO NOTFOUND
Recommended coding practices for procedures
SKIP FOUND IF EXISTS(filename) SKIP FOUND IF EXISTS(filename) <> 0 SKIP NOTFOUND IF NOT EXISTS(filename) SKIP NOTFOUND IF EXISTS(filename) = 0
Related Functions
For additional information about files, see the following functions:
Technical Considerations
- Due to anticipated enhancements for this function, it is strongly recommended that you use only zero or nonzero tests in your code. Do not attempt to test for a specific nonzero value.