This function can be used to test the application server’s file system for the presence of files and for some of their attributes.
The function takes two arguments, the first being a CHAR(1), which defines the test type (shown in the list below), and the second being a CHAR(255), which is the name of the file on which the test is to be done.
The function returns a INTEGER, which will be TRUE or FALSE, depending on the result of the test.
Test types for the fgl_test() function:
MAIN
DEFINE
file_path VARCHAR(20),
env_variable CHAR(60),
output_string1, output_string2 CHAR(80)
CALL fgl_winprompt(5, 2, "Enter the name of a file", "", 20, 0)
RETURNING file_path
#LET env_path = fgl_getenv(env_variable)
LET output_string1 = "The file " || file_path || " does not exist"
LET output_string2 = "The file " || file_path || " exists"
IF NOT fgl_test("e",file_path) THEN -- check if the file exists (not exists returns NULL)
DISPLAY output_string1 CLIPPED AT 5,5
ELSE
DISPLAY output_string2 CLIPPED at 5,5
END IF
sleep 5
END MAIN