×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
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.
As an Amazon Associate we earn from qualifying purchases.