From: Dave Laansma > How do I get a list of all files that are currently OPEN so I know whether > I need to open a given file again?
While our other colleagues are responding to the specific question, and I'm eager to see that discussion continue, I'll suggest that the real answer to the specific question asked might be to reframe the problem. In some applications if you don't have a specific file open, chances are you don't have any of them open. Some apps open all files for a given session on startup rather than doing it every time a user enters a program. This of course does not apply to all apps, nor all programs, nor all files. So the thing is to set a flag when you open files, and if you see that flag is set whenever you come back, you know All files have been opened, and you don't need to check for individuals anymore. SUBROUTINE FILE.INIT COMMON /FILES/ F.INITIALIZED, F.ERROR, F.HANDLES(100), F.NAMES(100) IF NOT(ASSIGNED(F.INITIALIZED)) THEN GOSUB INIT.FILES ; * Universe RETURN INIT.FILES: * * loop to Open F.NAMES(x) To F.HANDLES(x) Else F.ERROR = F.NAMES(x) F.INITIALIZED = TRUE RETURN * For Unidata, use IF UNASSIGNED(F.INITIALIZED) The thing is to call that code from every program that has a standard set of files. If you have already been in this code it exits painlessly. Most apps can do this because they're broken into modules like AP, AR, GL, WHS, etc. I did not implement handling for failed Opens - that's up to the app and context. In short, if F.ERROR is set when you come back from this routine, all bets are off and you need to fail out of the app. HTH T _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
