Thanks Scott,
Management wants to do as you suggested :
PGM
CHGLIBL LIBL(... as appropriate...)
CALL MYPGM
MONMSG CPF0000
CHGLIBL LIBL(... back to original...)
ENDPGM
BUT...
Wants to use these duplicated CLP as generic programs so that they would activate the ACTGRP for any program to call. By that I mean they want MYPGM to be a variable passed to the CL! OK, but how would you treat parameters? They would have to be the same for each pgm.
In my case I need a client number for MYPGM.
-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de Scott Klement
Envoyé : mercredi 7 janvier 2009 12:32
À : Midrange Systems Technical Discussion
Objet : Re: ACTGRP
Hi David,
*NEW activation groups end automatically when the program ends. (i.e.
the program that was built with ACTGRP *NEW). So there'd be no need to reclaim it when returning to the data entry screen! Because it was specified as *NEW, it's reclaimed automatically.
One challenge... *LIBL is not an attribute of the activation group, it's an attribute of the job. So when you change the *LIBL, you change it for all activation groups in the job. I guess that's not a problem as long as you're careful to change it back when your activation groups end.
If you don't want to close/open the files with each call, then you can't
use ACTGRP(*NEW). Instead, you could create 8 different NAMED
activation groups. Perhaps by having a simple CL program like this:
PGM
CHGLIBL LIBL(... as appropriate...)
CALL MYPGM
MONMSG CPF0000
CHGLIBL LIBL(... back to original...)
ENDPGM
Make that an ILE CL program (set the source member type to CLLE instead of CLP), and compile 8 different copies of it using the CRTBNDCL command. (or PDM 14, but make sure you prompt it) Have each copy use a different named activation group.
The programs that it calls ("MYPGM") would be ACTGRP(*CALLER). These would be your RPG program, and can be the same RPG program ... no need to have separate copies of it.
Since the RPG code is in *CALLER, and is run in a different activation group, there will be a separate activation for each one. If your data entry screen calls all 8 programs consecutively, it'll have 8 different activations, with 8 different sets of open files, etc. Then you don't have to open/close on each call if you don't want to.
It's really simple -- but hard to explain :(
David FOXWELL wrote:
Hello,
Starting from a data entry screen, I want to be able to call a program
using an activation group that lets me set up a library list for the
product entered. I currently have 8 different product environments.
Treating each product means using the same program to treat different
files but with the same names in different libraries.
I was thinking of having the program compiled with ACTGRP *NEW and
then deleting the activation group when the program returns to the
data entry screen.
Is it possible to have an activation group for each product so that I
don't need to close and reopen all my files between calls? I mean, if
I call myPgm in a named activation group ie, product1, then product2,
can I reuse product1 ?
If so, how would I get the same program to run in different named
activation groups? By duplicating the program?
Thanks.
David FOXWELL
Service Informatique
Tél : 03 90 23 91 63
david.foxwell@xxxxxxxxx<mailto:david.foxwe@xxxxxxxxx>
P Pensez à l'environnement avant d'imprimer ce message
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.