However, note that if you're using a web-environment, where your state variables are written to disk between browser calls, this won't work at all, since file-variables cannot be written to disk. So file open functions have to be done locally and not kept in common (as common may change from browser call to browser call) and file-variables cannot be saved to disk.

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* [email protected]
*To:* U2 Users List <[email protected]>
*Date:* 3/5/2012 10:41 AM
*Subject:* [U2] keeping track of opened files
So the guru question is: Does either universe or unidata provide a way to get a 
list of opened files from some internal list or pool?
I don't think so. Your application will need to keep track of each file as it 
opens them. Somewhere there's a universe technical bulletin that describes a 
method for this. you use a named common which contains 2 arrays, one for file 
names, and one for file pointers. When you want to open a file, you LOCATE into 
the name array and use the associated file pointer if found. If not, you open 
the file and add the name and pointer to the array.
On Mar 5, 2012, at 12:57 PM, Wjhonson wrote:

I have to guess that the OP really wanted something like
N.FILE = "CUSTOMER"; GOSUB CHECK.IF.FILE.IS.OPEN
IF ERROR.FILE THEN
   OPEN N.FILE TO F.FILE ELSE do something here
END ELSE
   IS.OPEN = TRUE
END

CHECK.IF.FILE.IS.OPEN:
some function which checks if N.FILE exists in some rotating pool of 
FILE(MAXFILES)
if so return file variable pointer set in F.FILE else set error flag in 
ERROR.FILE
RETURN


Of course the pseudo code above has to be filled in with appropriate site 
specific code
Here we use a subroutine FILE.OPEN whose pool of open files lives in global 
named common

I really think that is what the OP was after


-----Original Message-----
From: David Wolverton<[email protected]>
To: 'U2 Users List'<[email protected]>
Sent: Mon, Mar 5, 2012 9:51 am
Subject: Re: [U2] Hello


In that  case, where every file is named "FILE" in your programs, but you
ant to make sure FILE is opened against CUSTOMER, I would guess you would
o this:
IF (FILEINFO(FILE, 0) = 0) THEN
OPEN 'CUSTOMER' TO FILE ELSE
    ....
END
ND ELSE
IF FILEINFO(FILE,17) # "CUSTOMER" THEN
     CLOSE FILE
     OPEN 'CUSTOMER' TO FILE ELSE
        ....
     END
END
ND

David W.

----Original Message-----
rom: [email protected]
mailto:[email protected]] On Behalf Of Wjhonson
ent: Monday, March 05, 2012 11:06 AM
o: [email protected]
ubject: Re: [U2] Hello

don't think this will work.
n your example John, you need to know the file variable assigned to the
ile.
o
F (FILEINFO(CUSTOMER,0)=0) THEN
  OPEN "CUSTOMER" TO CUSTOMER ELSE...
But you can't use FILEINFO to check "CUSTOMER", only to check CUSTOMER.
o you can't tell if a file is opened already and to what file variable.
ou can only tell if a certain file variable is opened.

-----Original Message-----
rom: Israel, John R.<[email protected]>
o: 'U2 Users List'<[email protected]>
ent: Mon, Mar 5, 2012 7:56 am
ubject: Re: [U2] Hello

assume you have some way of knowing what files you want.
o something like:
F (FILEINFO(yourfilename, 0) = 0) THEN
PEN yourfilename ...
D
ohn
------------------------------------------------------------------------
----Original Message-----
om: [email protected]
mailto:[email protected]]
Behalf Of Dave Laansma
nt: Monday, March 05, 2012 10:38 AM
: U2 Users List
bject: Re: [U2] Hello
kay, I've got a pretty simple question ...
ow do I get a list of all files that are currently OPEN so I know whether I
ed to open a given file again?
incerely,
vid Laansma
Manager
bbard Supply Co.
rect: 810-342-7143
fice: 810-234-8681
x: 810-234-6142
w.hubbardsupply.com
elivering Products, Services and Innovative Solutions"
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to