SIMPLE CODE FOR COUNTING RECORDS (IN UNIDATA) :AE DAVID COUNT3
PROGRAM COUNT3 PERFORM "COUNT STUDENTS" NUM.RECS = @SYSTEM.RETURN.CODE PRINT "" PRINT "NUMBER OF RECORDS: ":NUM.RECS *--: FIBR Filed "COUNT3" in file "DAVID". Compiling Unibasic: oisdir/david/COUNT3 in mode 'u'. compilation finished COUNT STUDENTS 39635 record(s) counted. NUMBER OF RECORDS: 39635 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Laansma Sent: Wednesday, November 19, 2008 10:24 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Counting records Wol, In Unidata the COUNT commands does not leave an active select list. It just returns the number of records that match the criteria. David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office:810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Delivering Products, Services, and Innovative Solutions" -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony Youngman Sent: Wednesday, November 19, 2008 10:04 AM To: 'u2-users@listserver.u2ug.org' Subject: RE: [U2] Counting records Several things look a bit wonky to me here. Firstly I'd get rid of the first three lines with CMD = "COUNT ":FILENAME Then the routine as shown here leaves a hanging select list - NOT a good idea when the next person comes along and doesn't realise it. I've never used it, but isn't there a form of EXECUTE that will return the select list as a variable? I'd use that to "mop up" the select list. Then I'd do RCNT = @SELECTED (iirc there is such an @ variable) Failing any of those, after the execute, I'd do a READLIST to mop up the select list, followed by a RCNT = DCOUNT( variable, @FM) to get the count. Oh - and I'd return RCNT in the first argument. Makes it a lot more flexible - you can declare it as a function, call it from SUBR in i-descriptors, whatever whatever. Cheers, Wol -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Laansma Sent: 19 November 2008 14:05 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Counting records I have written the following subroutine to count files: SUBROUTINE HUB.COUNT.FILE (FILENAME,RCNT) CMD = 'COUNT' CMD<-1> = FILENAME SWAP @AM WITH " " IN CMD CALL SB.DISP(9,CMD) EXECUTE CMD CAPTURING MSG RETURNING ERR RCNT = ERR<2,2> IF RCNT = "" THEN RCNT = ERR<1,2> END 9999 RETURN END David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office:810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Delivering Products, Services, and Innovative Solutions" -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Symeon Breen Sent: Wednesday, November 19, 2008 8:34 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Counting records In udt there is a system function after you have done a select, system(11). E.g. EXECUTE "SELECT file" ; NUM.OF.RECORDS = SYSTEM(11) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of T Stokes Sent: 18 November 2008 22:59 To: u2-users@listserver.u2ug.org Subject: [U2] Counting records I am trying to remember a Universe function that returns the number of records in a file. Something like this. OPEN 'SOMEFILE' TO SOMEFILE ELSE STOP 201,"SOMEFILE" NUM.OF.RECORDS = UNKNOWNFUNCTION(SOMEFILE) -- View this message in context: http://www.nabble.com/Counting-records-tp20569376p20569376.html Sent from the U2 - Users mailing list archive at Nabble.com. ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database: 270.9.3/1786 - Release Date: 17/11/2008 17:24 ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/