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






>Date: Fri, 04 Feb 2000 23:18:50 -0500
>From: Mark McCarty <M_McCarty@worldnet.att.net>
>
>Can anyone tell me what to use instead of the FREE opcode.  We are
>converting to RPGIV from III and are getting conversion errors stating
>FREE is no longer a good opcode.  Any assistance would be GREATLY
>appreciated.

Mark, it depends why the FREE was coded.  FREE had three purposes:
1. Refresh the freed program so the next time it was called, it got
   reinitialized variables (same as if it had SETON LR the last time
   it was called).

   One fairly easy way to replace it is to change the program in
   factor 2 so that if you call it without parameters it just sets
   on LR and returns.  Then replace any FREE to that program to
   CALL without parms.  (If it is currently called without parms,
   set it up so it sets on LR if 1 parm is passed.)

   You can also run the freed program in a different activation
   group and reclaim the activation group instead of doing the FREE.
   This isn't a good solution for a quick fix though - the use of
   activation groups should be carefully planned.

2. Make the program with the FREE opcode "forget" which program it
   had just called, so the next call would re-resolve.

   There are several ways to replace it (an easy one is to add
   a wrapper program to make the call - to get the wrapper program
   to forget the actual program it called, make the wrapper program
   seton LR with some special parameter.)

3. None.

   It seems quite common that FREE was coded for no good reason
   except possibly a belt-and-suspenders sort of thing.  This is
   probably the use that has others on this list telling you that
   it's ok to forget about the FREEs.

FREE was never a good opcode.  The program being freed had
its static storage cleared, but it didn't have its files closed.
The files stayed open until the job ended, or until an RCLRSC
was done.  Injudicious use of FREE let to even more injudicious
use of RCLRSC to try and clean up the mess that FREE made.

I deliberately didn't suggest RCLRSC as a replacement for the first
use of FREE since it's even more of a blunt instrument than
reclaim-activation-group (often reclaiming much more than was
intended, and sometimes reclaiming less).

I wouldn't go so far as to suggest that FREE can just be removed.
In most cases this is true, but you should check the program being
freed and make sure it isn't depending on the FREE, especially if
if you find that not all called programs are freed, and that it's
the same program being freed all the time.

Barbara Morris


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

Follow-Ups:

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.