Yeah just be aware that you *cannot* setup file pointers in a dynamic array, 
but you can setup the names in a dynamic array
So you would
LOCATE N.FILE IN L.FILES SETTING W.FILE THEN
     F.FILE = FILES(W.FILE)
END

you have to use a dynamic for the names so you can do a locate, then you have 
to use a dim for the files

This is because file pointers themselves *can* carry the byte that says to a 
dynamic array "end of cell" and so break it.



-----Original Message-----
From: Ed Clark <[email protected]>
To: U2 Users List <[email protected]>
Sent: Mon, Mar 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 
ist of opened files from some internal list or pool?
 don't think so. Your application will need to keep track of each file as it 
pens them. Somewhere there's a universe technical bulletin that describes a 
ethod for this. you use a named common which contains 2 arrays, one for file 
ames, and one for file pointers. When you want to open a file, you LOCATE into 
he name array and use the associated file pointer if found. If not, you open 
he file and add the name and pointer to the array.
n 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 
ILE(MAXFILES)
 if so return file variable pointer set in F.FILE else set error flag in 
RROR.FILE
 RETURN
 
 
 Of course the pseudo code above has to be filled in with appropriate site 
pecific code
 Here we use a subroutine FILE.OPEN whose pool of open files lives in global 
amed 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"
 ----Original Message-----
 om: [email protected]
 ailto:[email protected]] On Behalf Of u2ug
 nt: Monday, March 05, 2012 10:32 AM
 : U2 Users List
 bject: [U2] Hello
 s the list alive ?  Haven't seen anything for a week.
 ______________________________________________
 -Users mailing list
 [email protected]
 tp://listserver.u2ug.org/mailman/listinfo/u2-users
 _____________________________________________
 -Users mailing list
 [email protected]
 tp://listserver.u2ug.org/mailman/listinfo/u2-users
 ______________________________________________
 -Users mailing list
 [email protected]
 tp://listserver.u2ug.org/mailman/listinfo/u2-users
 _______________________________________________
 2-Users mailing list
 [email protected]
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 
 ______________________________________________
 2-Users mailing list
 [email protected]
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 
 _______________________________________________
 U2-Users mailing list
 [email protected]
 http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
2-Users mailing list
[email protected]
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to