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


  • Subject: Re: RETURN op code
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Thu, 26 Jul 2001 18:29:40 -0500 (CDT)


On Thu, 26 Jul 2001, Chris Beck wrote:
>
> I have a question about this op code.  
> 
> when this is executed and LR is off, the program will remain resident
> in memory.
> 
> When is this memory cleared, when the calling program ends?  if so,
> does it clear if the calling program has a return and LR is off?
> 

For OPM (RPG III) programs, the program remains in memory until you
do a RCLRSC (reclaim resources) command, or until the job ends.

Though, back in those days I frequently passed it a parameter telling
it to shut down, so that when that parm was set to '*CLOSE' (or
whatever you choose) it would set on LR, and then end.

Supposedly, the FREE op-code could also be used to remove it, though
I never tried that...  Heard that it didn't work quite right, though.

For ILE (RPG IV) progams, the program remains in memory until the
activation group ends.  In fact, this is one of the main uses of
activation groups.

Keep in mind, though that if you use ACTGRP(*NEW), and then execute
a RETURN, the activation group will end immediately, unloading the
program with it.   This is why people tell you not to use ACTGRP(*NEW)
on a program that would be called repeatedly, it hurts performance.

On the other hand, ACTGRP(*NEW) is great for the "first" program that's
run from a menu (or whatever.)   This way, it can call other programs,
each one compiled with ACTGRP(*CALLER), in a loop, and then you know
that all the programs will get removed from memory properly when the
ACTGRP(*NEW) program ends. :)

Neat, huh?


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.