I worded that poorly.
On the other hand, I think you may have to <grin>.
Correct me if I'm wrong, but doesn't having the main procedure return
with LR = *ON only affect files specified in the same module as the
mainline? (Assume the program isn't running in a *NEW activation
group.) Certainly, if the module with the f-spec is being used from a
service program, the main procedure returning with LR = *ON wouldn't
close the file. (again assuming ACTGRP(*NEW) isn't used).
In the OP's case, it seems the issue is files specified in a module
other than the one that contains the mainline. I'm still not sure if
the module is bound by copy into the program or if it's in a service
According to the OP, every time a procedure is called the file is
being opened then closed when the procedure returns and the procedure
doesn't contain explicit opens or closes.
I can only think of two ways to duplicate the behavior the OP describes:
1) If the procedure is in the *SRVPGM, then the service program may
have been complied with ACTGRP(*NEW).
2) Otherwise, the procedure may be using SQL to access the file, and
the SQLRPGLE module was compiled with CLOSQLCUR(*ENDMOD) This would
cause the described behavior with the procedure bound by copy into the
*PGM or by reference from a *SRVPGM.
I'm throwing option 2 out there since it would match the behavior
exactly. I know it probably seems unlikly to most here on the list,
but I've seen lots of SQLRPGLE modules with F-specs of the files that
are actually being access via SQL.
On Fri, Aug 22, 2008 at 2:00 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:
Charles Wilt wrote:
Files referenced in a module with USROPN are only closed when you
explicitly close them, or the activation group and/or job ends.
Charles, having USROPN coded for a file doesn't affect whether it gets
implicitly closed. It only affects whether it gets implicitly opened.
If a main procedure returns with LR on, the USROPN files will get closed.
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives