Discussion:
Checking for existence of a file File Exists
Bob Rogers
2003-03-26 03:55:13 UTC
Permalink
We are using Informix IDS 7.something and 4GL (sorry forgot to get
version numbers) and I want to check for the existence of a text file
before I run a procedure. I was looking for file handling kind of stuff
and could not find any. Anybody got any ideas on how one can go about
checking for a file?

If necessary, I can get the version numbers, but I think the Front end
wtk 2.0.01 (?), database server( 7.2?) and 4GL programming version
(9.xxx?)
Bryce Stenberg
2003-03-26 04:30:18 UTC
Permalink
Hi, try following function - will get existence of a server side file.

##----------------------------------------------------------- file_exists
function file_exists( str)

define
str char(100),
file_found smallint

whenever error continue

call channel::open_file("xx000FileExistTest", str, "r")
if status < 0 then
# error: either file does not exist or is in use
let file_found = FALSE
else
let file_found = TRUE
end if
call channel::close("xx000FileExistTest")

whenever error call error_trap

return file_found
end function

Regards,
Bryce Stenberg.
Harness Racing New Zealand computer department,
-----Original Message-----
Sent: Wednesday, 26 March 2003 3:55 p.m.
Subject: [fourjs-users] Checking for existence of a file File Exists
We are using Informix IDS 7.something and 4GL (sorry forgot to get
version numbers) and I want to check for the existence of a text file
before I run a procedure. I was looking for file handling
kind of stuff
and could not find any. Anybody got any ideas on how one can go about
checking for a file?
If necessary, I can get the version numbers, but I think the Front end
wtk 2.0.01 (?), database server( 7.2?) and 4GL programming version
(9.xxx?)
CAUTION: This email message and accompanying data may contain information
that is confidential and subject to legal privilege. If you are not the
intended recipient you are notified that any use, dissemination,
distribution or copying of this message or data is prohibited. If you have
received this email message in error please notify us immediately and erase
all copies of the message and attachments.
ALSO, unless expressly stated otherwise, the contents of this message
represent only the views of the sender as expressed only to the intended
recipient, do not commit Harness Racing New Zealand (HRNZ) to any course of
action and are not intended to impose any legal obligation upon HRNZ.
Loading...