Problem solve Get help with specific problems with your technologies, process and projects.

The trouble with Reclaim Resources

The RCLRSC command could cause problems when converting applications to ILE. Here are four solutions to help you avoid trouble.

Be careful when converting applications to ILE, especially CL code. The Reclaim Resources command (RCLRSC) has...

no effect when run in an activation group other than the default activation group. If you convert an application and specify that it is to run in a *NEW or named activation group, it may not run properly if it relies on the RCLRSC command.

Most applications that execute the RCLRSC command do so periodically as a "garbage-collecting" device to improve performance. However, a small percentage of programs rely on the RCLRSC command to free static memory, close open files, and free certain other resources. For example, a frequently called RPG program may return without setting on LR. This keeps the program activated and saves time when the program is subsequently called.

Ron Turull

Sometimes, however, you may require that the program start anew and therefore execute a RCLRSC in the calling program before calling the RPG program. It works great until you convert the whole thing to ILE and tell it to run in an activation group other than the default.

Four possible solutions to this problem

Here are four alternatives to help you avoid problems with the Reclaim Resources command as it relates to RPG programs. Use the one that best fits each application.

  1. Do not convert the application to ILE. All non-ILE programs run in the default activation group and, for the most part, execute without regard to activation groups.
  2. Have the application run in the default activation group. This solution is feasible only if all your programs (systemwide) will run in the default activation group. Otherwise, it will be too difficult and perhaps impossible to implement.
  3. Add an extra parameter to the RPG program that, when set to a specific value, will direct the program to do nothing but set on LR and return. This implements the reclaim resources at the RPG program level. The RCLRSC command can then be replaced with a call to the RPG program that specifies the new parameter.
  4. Have the RPG program run in its own named activation group by itself. Then change the RCLRSC command in the calling program to a RCLACTGRP (Reclaim Activation Group) command, specifying the RPG program's activation group name on the RCLACTGRP command.

The last solution is the closest to the original implementation. It requires the least amount of program modification and makes good use of system resources. It also takes advantage of the latest ILE features.

Warning: Early editions of the ILE Concepts manual asserted that the RCLRSC command could be used to delete activation groups that are not is use. This was never the case. The RCLRSC command affects only the default activation group (which is always in use) no matter in which activation group it is executed. The misinformation was corrected in later editions of the ILE Concepts manual.

About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years experience programming for and managing AS/400-iSeries systems.


  • .PeYsaYEpcqR^6@.ee84636/1>Converting a non/ILE RPG program to an RPG/ILE program
    "IS man" asked , "Does anyone know of an easy way to convert a non/ILE RPG program to an RPG/ILE program?" expert Laird Scranton was on hand with an answer.

  • Will too many data paths cause poor performance?
    One user was having performance problems with a particular batch job. On examination the job had more than 2,000 open data paths mostly over the same files. Could that cause performance problems, he asked. Site expert John Brandt says yes and that the RCLRSC command can help.
  • Process a job under a different library list
    Sometimes there's a need to process a job under a different library list without using a job description to set the library list. When the job ends it is preferable to reset the library list back to its original values. member Shankar Narayan shows you how, making use of the RCLRSC command.

Dig Deeper on Performance