Unclassified RE: [U2] Testing if a Unidata file has records or not!
Frank, I wouldn't do it that way! If the file actually has a gazillion records in it, COUNT could take a l-o-n-g time! ;-) Another way could be to do EXECUTE 'SELECT file name SAMPLE 1'. IF @SELECTED EQ 0 THEN the file is indeed empty END ELSE the file is not empty END [This is the UniVerse syntax, but UDT should be similar] HTH Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bright, Frank Sent: Tuesday, 30 November 2004 10:38 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/ The information contained in this Internet Email message is intended for the addressee only and may contain privileged information, but not necessarily the official views or opinions of the New Zealand Defence Force. If you are not the intended recipient you must not use, disclose, copy or distribute this message or the information in it. If you have received this message in error, please Email or telephone the sender immediately. --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Testing if a Unidata file has records or not!
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. OPEN '',FILE_NAME TO FILE_VAR THEN SELECT FILE_VAR TO SEL_VAR REC_COUNT = 0 EOL = 0 LOOP READNEXT ITEM_KEY FROM SEL_VAR ELSE EOL = 1 UNTIL EOL REC_COUNT += 1 REPEAT END HTH, Ken --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Testing if a Unidata file has records or not!
I don't know if Unidata has it but in a Universe basic program if you open the file then do a BASIC select, (not a TCL SELECT) you can then use SELECTINFO(0,1) to report true/false if a select list is active in Select List 0. SELECTINFO(0,3) reports the count of the records selected. You can then do a CLEARSELECT if there were any data records. There is also the idea of doing the same BASIC select but instead of SELECTINFO, just do a single READNEXT. If you hit ELSE, it's empty. Again, CLEARSELECT to release the select list. Bob Woodward Programmer/Analyst Harbor Wholesale Grocery [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:owner-u2- [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/
RE: Unclassified RE: [U2] Testing if a Unidata file has records or not!
I'd recommend the same, but I'd use READNEXT instead of @SELECTED so there isn't a list floating around waiting to be used. EXECUTE 'SELECT filename SAMPLE 1' READNEXT DUMMY THEN EMPTY = 0 ELSE EMPTY = 1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of HENDERSON MICHAEL MR Sent: Monday, November 29, 2004 3:17 PM To: [EMAIL PROTECTED] Subject: Unclassified RE: [U2] Testing if a Unidata file has records or not! Frank, I wouldn't do it that way! If the file actually has a gazillion records in it, COUNT could take a l-o-n-g time! ;-) Another way could be to do EXECUTE 'SELECT file name SAMPLE 1'. IF @SELECTED EQ 0 THEN the file is indeed empty END ELSE the file is not empty END [This is the UniVerse syntax, but UDT should be similar] HTH Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bright, Frank Sent: Tuesday, 30 November 2004 10:38 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/ The information contained in this Internet Email message is intended for the addressee only and may contain privileged information, but not necessarily the official views or opinions of the New Zealand Defence Force. If you are not the intended recipient you must not use, disclose, copy or distribute this message or the information in it. If you have received this message in error, please Email or telephone the sender immediately. --- 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/
RE: [U2] Testing if a Unidata file has records or not!
I would do this: SEL.8 = 8 OPEN '', 'TEST.FILE' TO OPEN.FILE THEN SELECT OPEN.FILE TO SEL.8 READNEXT ID FROM SEL.8 THEN HAVE.RECORDS = 1 END ELSE HAVE.RECORDS = 0 END CLEARSELECT SEL.8 END This should work on UV and UD. Dick Kryka Director of Applications CCCS of Greater Denver, Inc. Paragon Financial Services 303-632-2226 [EMAIL PROTECTED] -Original Message- 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! --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] Testing if a Unidata file has records or not!
Quickest way I can think of would be: PRINT 'Enter Filename : ':;INPUT FILENAME PERFORM 'SELECT ':FILENAME:' SAMPLE 1' SELECTED = @SYSTEM.RETURN.CODE IF SELECTED THEN PRINT FILENAME:' contains records' END ELSE PRINT FILENAME:' is empty END PERFORM CLEARSELECT STOP -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bright, Frank Sent: Monday, November 29, 2004 13:38 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/