[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: opening file - determine if empty



I see you now have a working solution but for completeness I thought I would
make my contribution anyway.

I haven't tried this but if the file is on a Unix system I believe the
following should work.  The Unix "test" command can perform various
functions and return a true (0) or false (1) status (a return of greater
than 1 indicates an error such as 'no read permission').  The "test -s"
command will return True if file exists and has a size greater than zero.
So you could code something like:

        call system using 'test -s ' || $MyFile #Unix_Status
        if #Unix_Status = 0
                ! File exists and is not empty
                do Main-Procedure
        end-if

Wayne Ivory
Information Services
Iluka Resources Limited


-----Original Message-----
From: Wendel, Robbi [mailto:rwendel@NESPOWER.COM]
Sent: Tuesday, 8 August 2000 20:34
To: SQR-USERS@list.iex.net
Subject: opening file - determine if empty


Good morning,
I expect this is going to be a no brainer for some of you, but I am drawing
a big blank (sad but truthful)

I have a flat file that based on it's existence, we delete a table and
reload it with the contents of the file. There is the possibility that the
file could exist but be empty. So EXIST won't help. Is there a quick way
(function or code) that I can determine if the file is empty before
proceeding?

TIA,
Robbi Anne Wendel
SCT Corporation
rwendel@sctcorp.com
rwendel@nespower.com
(615) 747-3078
-------------------------------------------------------------------------