Thank you very much Barbara.
Lluis
________________________________________
De: rpg400-l-bounces@xxxxxxxxxxxx [rpg400-l-bounces@xxxxxxxxxxxx] en nombre de Barbara Morris [bmorris@xxxxxxxxxx]
Enviado el: viernes, 04 de marzo de 2011 21:46
Para: rpg400-l@xxxxxxxxxxxx
Asunto: Re: RPG ILE Problems (Activation Groups)
On 3/4/2011 1:13 PM, LuisMaldonado wrote:
Thank you Barbara
Now your example works and I understand.
If I open a file inside the SRVPGM and do RCLRSC and error ocurrs like you said.
But if SRVPGM has a PI and open the file inside the PI no error occurs. it´s correct ? why ?
Luis, I'm not sure what you mean by "SRVPGM has a PI".
But anyway, the syntax of the RPG code doesn't matter. The scenario
that will cause the problem is that the RPG module is in a service
program, and that the RPG module uses a file which is still open when
the RPG procedure returns to its caller.
Try adding a DSPJOB OPTION(*OPNF) OUTPUT(*PRINT) in your CL program
before and after you do the RCLRSC, to see if there are any files that
are open and that get closed by the RCLRSC.
If you have an RPG procedure defined with P specs, and you coded the F
spec within the procedure, like the procedure below, the the file would
be automatically closed when the procedure ends.
P c b export
Fqsysprt o f 80 printer
D prtDs ds 80
D line 80 inz('printer line')
D fld s 20a inz('init')
/free
dsply 'new value for srvpgm field' '' fld;
write qsysprt prtDs;
return;
/end-free
P c e
But if you coded the STATIC keyword on the F spec, then the problem
would occur, because the file would stay open when the procedure ends.
P c b export
Fqsysprt o f 80 printer static
...
Just a reminder, when working with service programs running in the DAG,
make sure you sign off and sign back on after changing the service
program. Or submit your tests to batch so you always get a fresh job.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.