Assuming all of these *PGMs are in fact running in the *DFTACTGRP, then
you can just issue:
RCLRSC LVL(*)
This works only for RPGIII programs but NOT RPGIV programs!
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Mark S. Waterbury
Gesendet: Tuesday, 07. September 2010 16:37
An: RPG programming on the IBM i / System i
Betreff: 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.
As an Amazon Associate we earn from qualifying purchases.