If all you want to know is whether a file has ANY records (not the specific number) something like the following should work, and should be pretty quick, regardless of the file size:
TESTFILE = 'SOMEFILETOTEST' OPEN '',TESTFILE TO FIL.TEST ELSE STOP "CAN'T OPEN ":TESTFILE HAS.RECORDS = 0 SELECT FIL.TEST LOOP WHILE READNEXT KEY.TEST HAS.RECORDS = 1 EXIT REPEAT CLEARSELECT Larry Hiscock Western Computer Services -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bright, Frank Sent: Monday, November 29, 2004 1:38 PM To: U2-Users Group (E-mail) Subject: [U2] Testing if a Unidata file has records or not! To All: I am writing an interesting program. One that finds where a file is empty of records or not. I used the EXECUTE command with the COUNT command to get the number of records in a file. If its 0 then the file is empty. But is there a better way as the execution command causes problem in other parts of this program. So, if anyone has any ideas along the lines of telling if a file is empty (Unidata file), could you please give me a note! Thank You Very Much! Frank Bright Univ. of the Arts [EMAIL PROTECTED] ___________________________________________________ Frank M. Bright [EMAIL PROTECTED] Administrative Computing University of the Arts (A15) http://www.uarts.edu 320 S. Broad St. 215-717-6081(w) Philadelphia, PA 19102 215-717-6087(f) Colleague 17.0.14 AIX 5.2.0.2 Unidata 6.03 ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
