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
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.


************************************************************************************************************************************************************************************************************
This message originates from Lincare Holdings Inc. It contains information 
which maybe confidential or privileged and is intended only for the individual 
or entity named above.
It is prohibited for anyone else to disclose, copy, distribute or use the 
contents of this message.
All personal messages express views solely of the sender, which are not to be 
attributed to Lincare Holdings Inc., and may not be copied or distributed 
without this disclaimer.
If you received this message in error, please notify us immediately at 
MailAdmin@lincare.com or (800) 284-2006.
************************************************************************************************************************************************************************************************************



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.