× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Not sure why open/close is not an option (performance? Something else?) If
it's a performance concern, one option would be to create a callback
function that would be executed xx seconds after use. Such a procedure
might close the file if it hasn't been used in 120 seconds, for example.
You'd need to set an alarm that would cause the procedure to activate. It's
usually best to trigger the alarm at the start of processing.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Better to remain silent and be thought a fool than to speak out and remove
all doubt."
-- Abraham Lincoln
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of dmosley@xxxxxxxxxx
Sent: Tuesday, September 07, 2010 10:50 AM
To: RPG programming on the IBM i / System i
Subject: Re: program won't let go of file

This brings up a problem that I have had for a while (and have just
worked
around it). (Insert 'that's what she said' joke here, hahaha)....

But on CGI/RPG programs, if I HAVE to directly call the RPG program via
the web, and that RPG program opens Service Programs, etc.
How does the service programs (and any open files within) get closed,
when
there is no CLP wrapper.

I know the proper answer would be to manually open/close the files,
within
service programs, but let's jsut say that's not an option.


David L. Mosley, Jr.
Technical Solutions Architect
Dancik International, Ltd.
2000 CentreGreen Way, Suite 250
Cary, NC 27513

www.dancik.com



"Mark S. Waterbury" <mark.s.waterbury@xxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
09/07/2010 10:37 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: program won't let go of file






Hi, David:

DFTACTGRP solution
=================
Assuming all of these *PGMs are in fact running in the *DFTACTGRP, then
you can just issue:

RCLRSC LVL(*)

in PGM1(CLP), right after the CALL to PGM2 returns to PGM1. This will
close all open files and end all active programs below the current
level
in the call stack.

NOTE: if somehow PGM4 or PGM5 were not compiled with CRTBNDRPG ...
ACTGRP(*DFTACTGRP) then this will not work. :-o

Named Activation Group solution
=========================
Another alternative would be to convert all of the called OPM programs
to ILE -- CLP to CLLE, and RPGIII to RPGLE, and create PGM2 with a
named
activation group, e.g. ACTGRP(PGM2) ... and create all the programs it
calls with ACTGRP(*CALLER). Then, when PGM2 returns to PGM1, PGM1
issues:

RCLACTGRP ACTGRP(PGM2)

This is one of the main benefits of using ILE with named activation
groups -- you can control termination of a named activation group far
more easily than with RCLRSC in "OPM compatibility mode" (in the
*DFTACTGRP).

I hope this makes sense ...

All the best,

Mark S. Waterbury

> On 9/7/2010 10:05 AM, David FOXWELL wrote:
Hi all,


Our RPG OPM's always had a parameter ReturnType so that we could
instruct them to return with either RT or LR on. At the end of
processing,
the caller would use a cleanup routine to call all the programs that
had
been activated. The called programs would then just set on LR and end.

For some reason unbeknown to me, this method was not used with RPGIV
programs.

Now, this (simplified)situation has "evolved" :

PGM1(CLP)
PGM2(RPGIII)
PGM3(RPGIII)
PGM4(RPGIV)
PGM5(RPGIV Converted from RPGIII)

Everything is running in DFTACTGRP.

When PGM2 is finished, it will call PGM3 with ReturnType to tell it
to
switch on LR and return. PGM4 does not have this facility and always
returns with LR off. As it does not know what PGM3 is doing, it never
calls PGM5 to tell it to set on its LR indicator and its files stay
open.

On returning to PGM1, I need PGM5 to be freed up. A file it uses is
staying open. The boss says to issue a call from PGM2 or PGM3 to PGM5
to
get it to switch on LR. I don't know if that would even work, would it?
Even if it did, there are other RPGIV called by PGM5 that would
probably
give the same problem. How do I get out of this mess?


TIA.
--
This is the RPG programming on the IBM i / System i (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 IBM i / System i (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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.