You can accomplish what you want quite effectively using dynamic or
non-dynamic subprograms. The key here is to maintain the database-name data
(including the 2-byte file number returned from dbopen, which is
initialized to low-values - binary 0's) in the main calling program (also
generally referred to as the outer block). This parameter is passed to any
subprogram required to access the data base. The actual data base open can
be performed by any of the subprograms (either dynamic or non-dynamic).
Prior to any required database access, the corresponding file number is
checked for equality to binary zeros, after which a call to dbopen is
performed only if true.
Since the file number is maintained by the main program and passed to
appropriate subprograms via the linkage section, the data base need be
opened only once.
Should not be too difficult to modify your programs accordingly.
I'll be happy to e-mail sample code when I return from IPROFs.
*************************************************
Gilles Schipper
GSA Inc.
Tel: 905/889-3000
Fax: 905/889-3001
*************************************************