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



Mihael,

That's one way of doing it, my I wouldn't recommend it.

Instead consider having an Init() and Cleanup() procedure in the service
program.

Init() would be called as the first step by every other procedure
(except Cleanup()) and take care of opening the files and any other
initialization that may need to be done.  Init() would also register
Cleanup() as an activation group exit procedure.  This means when the
activation group is ended normally, the Cleanup() routine would be
called.  Cleanup() would take care of closing the files and any other
cleanup that may be needed.

Scott Klement provides an excellent example of this technique here:
http://archive.midrange.com/rpg400-l/200406/msg00310.html

HTH,

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx 
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Knezevic.Mihael
Sent: Tuesday, July 18, 2006 3:07 AM
To: RPG programming on the AS400 / iSeries
Subject: usropn files and service programs

hi,

i got a procedure in a service program which might be called once in a
session f. e. in a maintenance program or  ten million times 
in a batch
program.

afaik the default advice of ibm is that files in a service program
should be defined usropn. but if i open and close the files on every
procedure call the batch program is really slow.

my solution would be to make at least three procedures in the service
program:
openFiles()
action()
closeFiles()

my batch program would look like this:

openfiles();

dow (xxx);
   ...
   action();
   ...
enddo;

closeFiles();

afaik if the service program is compiled with actgrp(*caller) and the
calling program is running in its own activation group the program
should run as expected.

is there any error in my way of thinking and are there any other
(better) solutions to this? i think this is quite a common problem and
probably everyone has faced this problem and found a solution. so i
would like to here your solutions.

thanx in advance

mk
-- 
This is the RPG programming on the AS400 / iSeries (RPG400-L) 
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




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.