Exists: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Exists(filename | 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''' [[internal function]] returns a nonzero value if the specified file ([[PROC]] or program)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 | The exists function returns: | ||
*a value of 1 for directories | * a value of 1 for directories | ||
*a number greater than 1 for files | * a number greater than 1 for files | ||
====Comments and Examples==== | ====Comments and Examples==== | ||
Line 12: | Line 12: | ||
{{Future|Future releases of [[Business Rules!]] may return the file type (e.g., 4 for internal, 9/10/11 for programs).}} | {{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 | 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 | 00010 IF EXISTS("filename") THEN GOTO FOUND | ||
Line 27: | Line 27: | ||
====Related Functions==== | ====Related Functions==== | ||
For additional information about files, see the following functions: | For additional information about files, see the following functions: | ||
*[[File]] | *[[File (internal function)]] | ||
*[[File$]] | *[[File$]] | ||
*[[FileNum]] | *[[FileNum]] | ||
Line 40: | Line 41: | ||
====Technical Considerations==== | ====Technical Considerations==== | ||
# Due to anticipated enhancements for this function, it is strongly recommended that you use only zero or nonzero tests in your code | # 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. | ||
<noinclude> | <noinclude> | ||
[[Category:Internal Functions]] | [[Category:Internal Functions]] | ||
</noinclude> | </noinclude> |
Latest revision as of 17:17, 22 May 2014
Exists(<filename>)
The exists internal function returns a nonzero value if the specified file (PROC or program)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.