I have an RPG program that I converted to ILE. Unfortunately, ILE doesn't support the FREE opcode. Am I supposed to call a CL program to perform a RCLRSC on the called program that was previously being FREEd? How are you folks accomplishing this?
I have an RPG program that I converted to ILE. Unfortunately, ILE doesn't support the FREE opcode. Am I supposed to call a CL program to perform a RCLRSC on the called program that was previously being FREEd? How are you folks accomplishing this?
I may be wrong, but I seem to remember that you don't need to do a FREE in ILE. I encountered that a few times and deleted the line of code and nothing bad happened, other than I am now bald.
Very cool! (And sorry about going bald, although you did make me laugh with that comment!) Thanks very much.
Kieth, FREE removes a program from memory. With ILE programs, you can do this by using activation groups. In most cases you are best off just leaving program in memory. You will find that the system does a good job of handling this. RCLRSC does not have the same effect on ILE programs running in named activation groups. It also is not equivelant to FREE because it will free up file resources. To get the equivelant of an OPM FREE, you would have to open files globally (scoped to the job), and use a named activation group or *NEW activation gorup. If you use a named activation group you would then RCLACTGRP ACTGRP(namedactivationgroup). You best bet is to look at the ILE Concepts manual. It has a good description of activation groups, how they are used, and how they can be used to seperate applications and their associated resources. David Morris
David, it seems to me that there's a slight difference, in that FREEing a program can be used in place of the the program returning with *INLR on. The FREE opcode will force a re-initialization of the program. There's no dynamic way to do that using activation groups (that I know of). While it's not that big an issue - instead of FREE 'MyProg', I have to have an explicit "shutdown" call to MyProg (I usually use a call with no parameters) - it isn't quite sufficient to say that activation groups replace FREE, at least not for those of us who wrote lots of programs relying on the setting of *INLR.src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Java400.net - Java/400 Freeware" align="middle"> Java400.Net - where the AS/400 speaks Java with an RPG accent Home of PBD1.2, the FREE Java/400 Client/Server Toolkit
Joe, You are right that there is no equivelant to FREE. The closest that ILE comes is activation groups, which may be overkill for the situation you describe. The best bet is to restructure those types of applications. You can usually assign a handle or session key to those values that need them. The October issue of Midrange Computing has an article "Put it in Storage" that describes some procedures that are useful for creating these types of session variables. I wouldn't recommend it, but you can get equivelant function with RCLACTGRP. If you run the called program (the one you want to free) in a named activation group, a RCLACTGRP to that activation group will remove the program from memory as though LR had been set on. Unlike FREE, files will be closed unless they are scoped to another activation group. Example roughly equivalent to FREE: PGMA activation group QILE PGMB activation group PGMB PGMA overides files to opnscp(*job) Repeatedly: PGMB is called repeatedly without LR PGMA issues RCLACTGRP(PGMB) David Morris