And - as a suggestion - as mentioned earlier - the array of file names
should contain ACCOUNT-FileName to ensure MainAcct-CustFile #
TestAcct-CustFile -- it's happened more than once the DIM'd array of file
handles survived a LOGTO and suddenly that person is trashing the MAIN
account data thinking they are in the TEST account.

We have a DIM(50) of file handles we carry around - I'm sure we could do 200
-- you're limited by the OS open files, but at the point you approach that,
U2 usually 'soft closes' the file (closes at OS level, but remembers your
handle and reopens on demand).

> >
> > Is there anyway I can open the file once (in the subroutine) and 
> > thereafter use the same file handle (to avoid opening the file each 
> > time the subroutine is called) ?
> >
> > All the code on this site opens the file in the calling routine and 
> > passes the handle to the subroutine.
> >
> > I want to rather make the subroutine a stand-alone, not 
> requiring more 
> > than the subroutine call added to the calling programs.
> >
> > I have a suspicion I can use named common - if so, does 
> this have to 
> > be declared in the calling routine (which would negate my purpose!).
> 
> Yes - I use this approach and it works fine.  In short, I 
> build a COMMON array with file handles and a dynamic array 
> with the names of the open files.
> 
> At first invocation, you need to check to see if the COMMON 
> vars are initialized or not - if not, you initialize them.  
> Once this is done I merely look for a filename in the dynamic 
> array, if found it returns the file handle for I/O.  If it's 
> not present it opens the file, adds the filename to the list 
> and you go on.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to