×
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.
First things first - better design would mean we would need to know what
your constraints are and what you are trying to achieve. It sounds like you
mainly want it to run faster but it's hard to tell if this is the only goal.
How often you run the process and what side-effects it has or restrictions
it causes would also help decide what a better design was.
I have to say if I was going to rewrite this, my initial thought would be to
either improve the CL and take more advantage of blocking (if possible) or
to rewrite it to use SQL. Certainly, these days, the SQL route would be
uppermost in my mind.
I don't know that I'd go the RPG route; my only experience with making RPG
outperform a well setup copy file was by multi threading the process: i.e.
running multiple RPG read-write jobs side by side. As I recall the CPYF
could not be multi-threaded as it locked the file (but I'm open to
correction on this). That was on a file with 160 million plus records. I
don't know that you'd get the same bang for buck I did if you tried that on
your file, but it might be worth a shot. You would need to pay some
attention to disk arm activity if you go this route as too many parallel
processes will perform worse than a single process; number of processors
available to your job will also impact this.
Thinking outside the square a bit, if it's a case of needing the files
quickly at period end or minimizing downtime some other options present
themselves:
- Add a trigger to the file so that the records get written to BFILE when
they get added to AFILE
- Save and restore the entire file into a different library and then delete
the records you don't want to get your BFILE
The best approach also depends on how much of AFILE ends up in BFILE. If it
was more than 50%, then copying the entire file using blocking and deleting
the records you don't want might be faster. SQL deletes might be an option
here.
Food for thought, hope this helps somehow.
Regards
Evan Harris
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of donna lester
Sent: Tuesday, 30 September 2008 11:42 a.m.
To: rpg400-l@xxxxxxxxxxxx
Subject: Re writing CL in RPG
Hi
Below is my code. I am trying to replace copy commands program by writing
RPGLE.
Is this a good design , will this run faster? I would like to know your
opinions and suggestions.
Thank you for your time. The number of records in AFILE usually more than a
million.
=========================
* Copy data from ABCFILE by ID, NAME, Acct
C k_idnamacc Setll ABCFILE
C Read ABCFILE
C DoW Not %Eof(ABCFILE) and MID = YID
C and MNAME = YNAME and MACCT = YAcct
C Write XYZMNYREC
C Read ABCFILE
C EndDo
* copy data from AFILE by ID, NAME, Acct
C k_idnamacc Setll AFILE
C Read AFILE
C DoW Not %Eof(AFILE) and PID = YID
C and PNAME = YNAME and PACCT = YAcct
C Write XYZPOSREC
C Read AFILE
C EndDo
*
C Read GEUKACT
C Enddo
*
* Copy ABCFILE records for ID F
C 'F' Setll ABCFILE
C Read ABCFILE
C DoW Not %Eof(ABCFILE) and MID = 'F'
C Write XYZMNYREC
C Read ABCFILE
C EndDo
*
* Copy AFILE records for ID F
C 'F' Setll AFILE
C Read AFILE
C DoW Not %Eof(AFILE) and PID = 'F'
C Write XYZPOSREC
C Read AFILE
C EndDo
*
C Eval *inlr = *on
C *InzSr Begsr
C k_idnamacc KList
C KFld YID
C KFld YNAME
C KFld YACCT
C Endsr
Donna.
As an Amazon Associate we earn from qualifying purchases.
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.