Hi, Dave:
See my embedded remarks below.
Mark
> On 7/27/2012 8:00 AM, Dave wrote:
Thanks for all the help.
Manager has decided. Everything will be converted to ILE. Calling
program will run in ACTGRP 1 with LIBL 1, and will need to transmit
parameters to callee in ACTGRP 2 with library list 2.
The calling program (or the callee) must ensure that the correct *LIBL
is in place, each time the "callee" is called (in AG2).
This means that your (calling) program must re-establish the correct
library list (LIBL2) each and every time it calls the "callee" program,
and then restore the original *LIBL (LIBL1) immediately upon return.
One way to do that is to write a small CLLE "wrapper" program, so that
the caller calls the "wrapper" which sets up the correct *LIBL, then
calls the "callee", and upon return from the "callee", the "wrapper"
restores the previous (saved) *LIBL, then. returns to the "caller".
If all of those alternate files are in a single library, perhaps your
CLLE "wrapper" needs only to do something like this:
PGM PARM(...)
ADDLIBLE LIB(ALTLIB) POSITION(*FIRST)
CALL PGM(CALLEE)
RMVLIBLE LIB(ALTLIB)
RETURN
ENDPGM
I believe this will permit the double use of the same file in the same
library, ie in ACTGRP 1 and 2. But I also believe that if the callee
is required to use MyFile in LIBL 2, and the caller has already opened
and left open myFile in LIBL 1, then the callee will use this file
even if it is not in the libraries of LIBL 2.
All file opens are implicitly scoped to the (containing) activation
group. The "callee" will not use "this file" that was "left open" by the
caller, if the caller is in a different activation group than the
callee. This is the whole point of activation groups, to provide a way
to "draw a box around" a set of resources, such as files, open data
paths, dynamically allocated memory, etc., so they can all be closed and
disposed of, together.
I suggest you visit:
http://www.scottklement.com/presentations/ and look for the
presentation named "ILE Concepts (for the Impatient RPG Programmer"
Download and study that one.
There are also many other good presentations on this web site. (Thanks,
Scott!)
PROTOTYPE
Write some small "test" programs that run in multiple activation groups,
to experiment with the proposed approach, opening the same named file in
different libraries, as a "proof of concept" before you proceed to
modify the actual application.
As an Amazon Associate we earn from qualifying purchases.