|
Yes, but "IF NOT %OPEN(Filename)" will work the same way, as without USROPN: files remain opened until explicitly closed. Your method is better only in case SRVPRG contains procedures, which are not used frequently. Marcin Drozdowski -----Original Message----- From: Smith, Nelson [mailto:NSmith@lincare.com] Sent: Thursday, March 07, 2002 10:12 PM To: 'rpg400-l@midrange.com' Subject: RE: SRVPGM: USROPN file or not If I understand correctly, if a program references a procedure in a service program, on startup of the programs the references are resolved and this causes the service program to be also be started up. If the service program has 20 files in it, without USROPN, all 20 files will get opened, even though the procedure your program was using only referenced one (or even none) of the files. Therefore, I always use USROPN on the files and in each procedure that uses a file, I put: IF NOT %OPEN(Filename) OPEN Filename ENDIF and then ignore the error messages you refer to below. This way only the files actually being used get opened WHEN they are used and then they stay open for subsequent use as long as the activation group is alive. I've had no problems with this so far. > -----Original Message----- > From: marcin.drozdowski@big.pl [SMTP:marcin.drozdowski@big.pl] > Sent: Thursday, March 07, 2002 2:40 PM > To: rpg400-l@midrange.com > Subject: SRVPGM: USROPN file or not > > Procedure in my SRVPGM is called frequently, both from batch (server) > and interactive jobs. RPGLE programs are running in named activation > group. > IMHO it's good idea _not_ to declare files in SRVPGM with USROPN, but > compiler says: "Files should be closed explicitly when NOMAIN is > specified on the Control specification". > The message has severity 10 and SRVPGM is created. > Will it have any bad influences? > > Thanks for advice. > Marcin Drozdowski > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.