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



Some of the service programs I've seen, and written, use a startup
and shutdown routine.  A fairly good example of this is one I wrote
to step through the files waiting for being received on the QSNADS
queue.

The startup routine initialized some static variables and opened the
sytem object that contained the details on the queue entries (I don't
remember if it was a file or a data area).

Then the program would call the routine to step through the queue
entries returning the desired information (file name to receive, user
name, etc...).

At the end, the program needed to call the cleanup routine that would
close the file/object and end gracefully with LR on.

You are going to want to do something similar, I believe, to close
your files.  If you set them as user open you can close them gracefully
by just trying to close them.  You can close a file that is not open in
an RPG program without consequence.  From the manual:

   The explicit CLOSE operation closes one or more files or devices and
   disconnects them from the program.  The file cannot be used again in the
   program unless you specify an explicit OPEN for that file.  A CLOSE
   operation to an already closed file does not produce an error.

Another option is to have your shutdown program set on LR, although
I found I prefer useropen files in service programs.

I don't think you want to leave the files open for a number of
reasons, the primary two being:
1. Your service program is maintaining a lock on the file.
2. Your service program is using resources to keep the file open.

Regards,

Jim Langston

-----Original Message-----
From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
Behalf Of Jade Richtsmeier
Sent: Friday, September 14, 2001 7:27 AM
To: RPG400-L@midrange.com
Subject: Open files problem?


We are going to have the situation of an OPM program calling a series of ILE
programs.  The ILE programs are compiled with an activation group of
*caller, and all is well.  The only problem we have is that there are files
opened in service programs that are not be closed when the OPM program is
exited.

We've come up with three options of handling this:

1.  Have the OPM program execute a shut down routine that would close all
files that have been opened.  The problem with this is, how do you know what
files have been opened, unless you know all of the details of each file that
was opened when a service program was called.

2.  Use a named activation group when calling the ILE programs, and have the
OPM program reclaim the activation group at the end of the process.

3.  Leave the files open.  What issues are we going to have to deal with if
we do this?

Thanks for any and all input!

Jade Richtsmeier, Programmer/Analyst
Minnesota Counties Information Systems
413 SE 7th Avenue
Grand Rapids, MN



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.