No service program in use, it is bound by copy. The module has a NO MAIN clause on the H: spec and only has one procedure. There is no SQL involved. The module opens one of two files depending on what was passed and does one chain operation and then returns

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Friday, August 22, 2008 3:01 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Open/close files in an RPG module

Sorry Barbara,

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
program.

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.

Charles

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,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
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,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2019 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].