There is much better OOP-style solution to the file variable problem.
Create a named COMMON that is defined in one program only - the program
responsible for reading/writing a record of the data. It will open file when
it first needed if it is not opened yet and do the writing. And never again
anywhere in your programs you will have to write
READ RECORD FROM FILE,KEY THEN
or
READ RECORD TO FILE,KEY THEN
Just do:
CALL IO.PROGRAM('READ',TABLE.NAME,KEY,RECORD,OK)
or
CALL IO.PROGRAM('WRITE',TABLE.NAME,KEY,RECORD,OK)As COMMON appears only in one program - IO.PROGRAM (or whatever name you give to it), it is not used to pass parameters around. You might call this "encapsulation" (obviously it is not full-blown OOP but it is better then nothing). The side-effect of this is that because of all read-write is via one program it is very easy to add additional functionality later (e.g. to start logging all "writes" into a log file later during the life of the system - you don't have to change all programs where you write data for that). The rule is - if you thinking to pass parameters using COMMON there is always a better solution if you think about it. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, February 15, 2006 1:48 PM Subject: Re: [U2] [UV] GOSUB variable-name? <cut> > Additionally, there are many valid uses for COMMON blocks that have nothing > to do with OOP. There have been numerous discussions on this list > regarding the overhead of opening files, and having a common block of file > variables available in each routine makes more sense than having each > routine open the files it needs. <cut> > > --Tom Pellitieri > Toledo, Ohio > ------- > u2-users mailing list > [email protected] > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
