![]() |
PING
0.9
Statistical data handling and processing in production environment
|
Check the existence of a file given by its name. If required, also possibly check the format.
fn : full path and name of external file (!not a fileref!);ext : (option) string representing the extension of desired format (e.g., csv); if not set, the format of the file is not verified.ans : error code associated to test, i.e.:
0 if the file exists (with the right format when ext is not empty), or1 if the file does not exist, or-1 if the file exists but the format is not the one specified by ext.Let us consider the file where this macro is defined, and check it actually exists:
returns ans=0, while:
returns ans=-1.
Run macro %_example_file_check for more examples.
In short, the error code returned when ext is not set is the evaluation of:
%ds_check, %dir_check, %lib_check, %file_copy, %file_delete, %file_name, %file_ls, %file_move, FILEEXIST.