Exists

From BR Wiki
Revision as of 14:11, 15 January 2012 by Mikhail.zheleznov (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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 now 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

  1. 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.