OK, I think know a better explanation, This is how I read the code.

If not %open(file);
open (file);
openfile = *on;
endif;

Given that logic. If the file is already open, another procedure may have
opened the file and this procedure will not open it.

If the code then did:

IF %open(file);
close(file);
endif;

It would be closing a file it did not open. So by checking the flag, it
does not close files it did not open.

Again, that was how I read the code to work.




rob@xxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
03/20/2008 11:07 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: RPG-ILE Service Pgm and Opening/Closing Files






I think his question was why not just do a
if %open(myfile);
close myfile;

instead of
open myfile;
myfileOpen=*on;
...
if myfileOpen;
close myfile;

I wondered the same thing. And assumed it had something to do with the
thread and multiple stuff...

Rob Berendt

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.