|
Slava wrote: >Well, >i should have give more information. > >RPG procedure being called which using one PF. > >there is no manipulation done with the file upfront and procedure does not >have USROPN option. > >File is being open as soon as procedure started. > >I have move *on *inlr instead of Return there ( i guess it should work >too). > >When procedure is finished and control returns to the calling program file >stays open. > >If i close file prior to exit from the procedure then next time when >procedure executed file will not be open automatically and it will errored >out because file will be used without being open prior. > >I am suspecting that this is how it suppose to work. Program is not >finished and that is why files are not being closed. Here's what's happening: Within a program, if the RPG logic cycle reaches *GETIN and the *INLR indicator is on, then total calcs are performed and the program terminates, which includes closing all the open files in the program. When you return from a procedure within a module, you never reach *GETIN, and so you don't perform the program termination logic. That's why the files stay open even though you set *INLR on. Here are some ways to code what you want: 1) Code USROPN on the F-Spec, and explicitly open and close the file. Or 2) Check if the file is open at the beginning of the procedure, and open it if it's not already open. Then close the file when done. Cheers! Hans Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.