Hi all, UniVerse and SB+ also have this technique built in.
UniVerse is via the OPEN.FILE.B in the APP.PROGS file (uv account) and SB+ via the SB.FILEVAR.S subroutine. I had written an article regarding the UniVerse routines: http://u2blog.org/2007/11/05/appprogs-open-tools/ Cheers, David Murray .learn and do .excel and share -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Ballinger Sent: Thursday, January 24, 2008 11:37 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Universe 20.1 itype perf enhancer Hi John, As you surmised, this is not a new trick. Here is my version: SUBROUTINE OPEN.FILE.SUB(FILENAME,FILEVAR,ERROR) * open filename to filevar, keep opened files in named common * 01-20-01 asb COMMON /OPEN.FILE.SUB/ FILENAMES,FILEVARS(1000) IF ASSIGNED(FILENAMES) ELSE FILENAMES = "" END ERROR = "" LOCATE(FILENAME,FILENAMES;POS) THEN FILEVAR = FILEVARS(POS) END ELSE OPEN FILENAME TO FILEVAR THEN IF POS LE 1000 THEN FILENAMES<POS> = FILENAME FILEVARS(POS) = FILEVAR END END ELSE FILEVAR = "" ERROR = 1 CRT @(0):"ERROR! can't open ":FILENAME:@(-4) END END RETURN In use, you CALL OPEN.FILE.SUB("MYFILE",FILEVAR,ERR) ; IF ERR THEN .... Interestingly, on D3 this does not seem to have much benefit, where the OPEN function seems faster than the LOCATE. /Scott Ballinger Pareto Corporation Edmonds WA USA 206 713 6006 On Jan 24, 2008 6:56 AM, john reid <[EMAIL PROTECTED]> wrote: > I just saw this today, and although i am certain that everyone must > know it already, i am including it. > For itypes that call subroutines, where the subroutines open lots of > files, put a named common in the subroutine that contains what amounts > to dimensioned arrays that hold the file vars. Put a switch in so that > the files are opened only once. > Anecdotally, this appears to work more efficiently than not having the > common. If there are reasons why this is ill-advised, I'd like to see > that as well. > thanks. > John > COMMON /SETUP.STUFF/MY.FILES(15),FIRST.IN.SWITCH > -- > john > ------- > 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/