In our CL's I use RCLRSC LVL(*CALLER) if needed. Not sure this will help you but, when our users get back to their main menu then can have lots of files still open. This fixed the issue.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Singh, Ashwani (Lake Mary)
Sent: Thursday, August 25, 2016 2:17 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Files left open
Jose, thanks for reply but the real question is how to identify the program which had left the instance of the file opened, for all the reasons you listed below.
The jobs stream has 100's of inline calls which one left the file open is the problem as the file may be cleared/deleted by a program way after the one which left it open has ended.
Thanks,
Ashwani
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jose Perez
Sent: Thursday, August 25, 2016 2:54 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Files left open
Use WRKOBJLCK, besides be aware of this your process should not leave any file open once it finish, if you have service program using Return instead of *INLR=*ON this keep the file open. Local files used in a procedure ( If you code an F spec after a P spec, then that file is local to the
subprocedure.) are automatically close once the procedure end now if you use STATIC keyword on your local file,that means the file will remain open at its current position and keep open between calls of procedures, file will be close when at the very end of your process you use the operation code CLOSE, instead if file is Defined as a Global File (Before or outside of a procedure P and program does not have Main or NOMAIN keyword) then this kind of file should be close once you do *INLR=*ON, other way to get rid of your issue is to determine when to open and close the file and this can be done using the keyword USROPN when defining the file and then Open when needed and close it when no needed.
On Thu, Aug 25, 2016 at 12:30 PM, Singh, Ashwani (Lake Mary) < Ashwani.Singh@xxxxxxxxxx> wrote:
We are experiencing some issues with Files being left open by calling
programs (we are trying to fix these as well by ensuring that
programmer are including the shutdown calls in the service programs
they are building
etc.) in our batch processing, causing issues later on when some other
program in the job stream tries to clear the file.
My question is can we find which program has left a particular
instance of file open so that we can identify and correct these issues quickly?
Thanks,
Ashwani
--
This is the RPG programming on the IBM i (AS/400 and 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.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and 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.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
--
This is the RPG programming on the IBM i (AS/400 and 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.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.