Hi ya'll,
Actually I got this sorted out.  There are some things about it I don't
understand -- and I tried to open and close files to see what affect I could
have and still don't understand some of it.  But this program will cause a
nice display of the situation, so since I typed it in I thought I'd share it
back.  Thanks!

SUBROUTINE TEST.OPEN.FILES
5 *                                                                    
FILES.INFO = SYSTEM(50)                                                
*                                                                      
MAX.FILES  = FILES.INFO<1,1>                                           
HASH.OPEN  = FILES.INFO<1,2>                                           
DYN.OPEN   = FILES.INFO<1,3>                                           
RECOV.OPEN = FILES.INFO<1,4>                                           
SEQ.OPEN   = FILES.INFO<1,5>                                           
IDX.OPEN   = FILES.INFO<1,6>                                           
CLS.OPEN   = FILES.INFO<1,7>                                           
*                                                                      
TOTAL.FILES=HASH.OPEN+DYN.OPEN+RECOV.OPEN+SEQ.OPEN+IDX.OPEN+CLS.OPEN   
*                                                                      
CRT @(-1):                                                             
CRT "Unidata SYSTEM(50) query of open files"                           
CRT                                                                    
CRT "Maximum files that can be open ":MAX.FILES                        
CRT "Total files currently open     ":TOTAL.FILES                      
CRT                                                                    
10 *                                                                   
NO.AMS = DCOUNT(FILES.INFO,AM)                                         
FOR X = 2 TO NO.AMS-1                                                  
  CRT FILES.INFO<X,1> "L#10":FILES.INFO<X,2>     
  IF NOT(REM(X,18)) THEN CRT @(0,23):;INPUT JUNK 
NEXT X                                           
999 *                                            
CRT @(0,23):"<Finished>" ;INPUT JUNK
RETURN                                           


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 22, 2006 9:15 AM
To: u2-users@listserver.u2ug.org
Cc: [EMAIL PROTECTED]
Subject: RE: [U2] Managing open files

If you're on a late enough version of UD have a look at SYSTEM(50). I
can see it on my system as of 6.0.12 but not at 5.1.27.

Here is a snippet from "help system"

50 The UniBasic SYSTEM(50) function returns a list of files open
in UniBasic as a dynamic array. The first field is multivalued, and
contains the following information:
Value 1 - The maximum number of files that can be opened system-wide.
Value 2 - The current number of hashed files open in UniBasic.
Value 3 - The current number of dynamic hashed files open in UniBasic.
Value 4 - The current number of recoverable hashed files open in
UniBasic.
Value 5 - The current number of sequential and OS-level files open
          in  UniBasic.
Value 6 - The current number of index files open in UniBasic.
Value 7 - The current number of temporarily closed files in UniBasic.

This should give you everything that you need.

HTH
Colin Alfke
Calgary Canada


>-----Original Message-----
>From: Susan Joslyn
>
>Greetings group,
>
>I have a problem at a new installation of PRC on a 
>Unidata/Windows system.
>There are a couple of occasions where I get an announcement 
>that "too many files" are open, and my program bombs.  I think 
>it's the combination of files that the application software 
>has open as well as the ones I have open at that moment, plus SB+.
>
>The most helpful thing for me would be some function that will 
>tell me at any given time how many files I have open and what 
>files they are.  I can't find anything like that.  I have ways 
>that I can determine what files I have open, and SB+ keeps a 
>list of the ones it has open.  But I don't know what the limit is.
>
>I guess I'm going to have to take the "known places" where 
>this is occurring (as they occur) and close all of my files 
>that I don't need and hope it's enough.
>
>Anyone know of anything that will help me solve this problem?  
>All advice appreciated!  
>
>Cheers,
>Susan Joslyn
>p.s. I'm a digest subscriber so I'll either see responses 
>later (which is fine, I'm in no hurry) or you can copy me 
>directly at [EMAIL PROTECTED] if you like.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to