[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
- Subject: Re: opening file - determine if empty
- From: Bill Beckner <Bbeckner@ICC.CC.IL.US>
- Date: Tue, 8 Aug 2000 07:46:07 -0500
Here's a solution we use...the first bit of code determines if the file
exists, the second bit of code merely loops through reading the file and
exiting the loop at the end of file. Hope this helps!
Let $FileName = 'P:\BILL\DATA\HR\PSPTFPCT.TXT'
open $FileName as #In for-reading record=12:fixed
status=#InStatus
If #InStatus = -1
show 'Error in opening ' $FileName
STOP
End-If
While 1=1
READ #In into $Line:12
If #End-file = 1
BREAK
End-if
Do Process-Main
End-if
--
William Beckner -- Stunt Programmer (Just call me "Bill")
Illinois Central College, Rm L141 -- East Peoria, IL 61635-0001
PH: (309) 694-8419 -- FAX: (309) 694-8995
"Take my advice - Don't listen to me!"
-----Original Message-----
From: Wendel, Robbi [mailto:rwendel@NESPOWER.COM]
Sent: Tuesday, August 08, 2000 7:34 AM
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