× 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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.