Ask the Expert

Closing a RPG program

I'm running an original HTTP server and have a CGI program that executes a subprocedure several times, as necessary. This subprocedure, in turn, calls an RPG III program for some calculations. The problem is after the page is displayed, the files from the RPG III program stay open in the job where the CGI program ran. How do I close those files? Changing the RPG III program is not an option as it exists in another system that also uses it.
I assume the called CGI program stays active. If the called RPG program does a return, instead of an exit (seton lr), the files in that program in the call stack can remain open. Although it adds some overhead, a simple solution would be to call the RPG program that leaves the files open from another RPG program that does an exit instead of the return. The exit in the calling RPG program forces all sub programs to close completely on the job call stack. That should fix your problem with open files in the called RPG program.

If you want to decide dynamically when to close the files, use a conditional return or exit in the new calling RPG program that calls the RPG subprogram.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Check out these Best Web Links on Web development.

Ask the Experts yourself: Our Web development gurus are waiting to answer your questions.

Ask your Web development & WebSphere questions -- or help out your peers by answering them--in our .fMFNafNPDOX.2@.ee84637!viewtype=&skip=&expand=>WebSphere & Web Development Forum.

This was first published in May 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: