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



On 14-Dec-2015 02:10 -0600, Steinmetz, Paul wrote:
On Friday, December 11, 2015 6:43 PM Vinay Gavankar wrote:
We have a program which receives some values thru Data Queue read
and it updates a file with the values received.

The problem is that there are multiple copies of the file it needs
to update.

Let us say it is updating FILEA, so that is what is in the
compiled code.

On the system there are currently 15 files which are exact copies
of this file. They have a different file name, but the the same
record format name, field names etc.

The program reads a 'control' file, which has the names of these
15 files. For every file, it does an OVRDBF of FILEA to the actual
file name, Opens the file, updates/writes the record, and then
Closes the File.

The system was built for 'flexibility' years back, when they
started with 2 or 3 files. It is flexible, in the sense it did not
need a code change as the files being updated grew from 3 to 15.

This is a very 'busy' program, meaning it is constantly receiving
data thru the data queue. Actually there are multiple copies of
this program running simultaneously receiving data from the same
data queue and all of them are pretty busy.

Now they are finding that all these open/closes are seriously
impacting the CPU usage.

An architectural change is obviously indicated, but that would take
time to implement.

As usual, they are looking for a 'short term', quick and dirty fix
(to be implemented in 2 weeks) to eliminate these open/close.

The only thing we could think of was to define the current 15
files separately in the program and then update them as needed,
losing all flexibility.

Any other ideas or suggestions would be greatly appreciated.

I've been following this thread.
One of the simplest methods is to NOT set on LR when exiting the
program, This leaves all files open for next call.
We use this procedure often batch programs.
Many good articles related to LR.
Search "RPG LR" and/or "RPGLE LR"

http://www.mcpressonline.com/programming/rpg/practical-rpg-activation-groups-and-*inlr.html

For every file, it does an OVRDBF of FILEA to the actual file name,
Opens the file, updates/writes the record, and then Closes the File.

The implementation is slightly different depending if RPG or RPGLE.


I am not sure, but I get the impression that the code described in the OP, is performing effectively the following, in pseudo-code, for which the LR would not be relevant; the program could even be coded as a linear-main [http://archive.midrange.com/rpg400-l/201209/msg00263.html]:

open control_file ;
do forever ; // run as NEP in batch
dequeuedDS = receiveDQ() ; // dequeue msg into a DS
tgtForIO = getFileName(dequeuedDS.revealing_details) ;
ovrToFileA(tgtForIO) ; // ovrdbf FILEA TOFILE(tgtForIO)
open FILEA ; // open the tgtForIO vs FILEA per above OVRDBF
processDQ(dequeuedDS) ; // write\update\delete per msg deq'd
// dltovr optional, because a new ovrdbf FILEA overwrites
close FILEA ; // close the tgtForIO vs FILEA per above OVRDBF
enddo ;

Of course, as I had noted in an earlier reply, I have not yet read much of the thread, not even followup replies by the OP, so perhaps something was revealed already to contradict that impression I had.?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.