Hi James,
I don't know if things have changed, but historically I've always seen significantly slower times when using CPYTOSTMF than when writing to the IFS directly from RPG via APIs (and writing directly from RPG to the IFS also has the benefit of skipping intermediary processing such as writing to a temp file before passing it along).
I know you said you used CPYFRMINPF to export the file to CSV, but I guess that confuses me b/c from the looks of it that command copies the file from the IFS to your library.
Some info on writing directly to the IFS via RPG:
http://www.news400.com/resources/clubtech/tnt400/bo400ng/AS400Q0167.htm
-Kurt Anderson
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James Perkins
Sent: Friday, November 13, 2009 12:45 PM
To: RPG programming on the IBM i / System i
Subject: Service Program Overhead
Hello All,
I had to write a program to write DB data to a stream file in comma
delimited format. No problem, done it many of times. Then I ran into a
problem, running the program seemed to take hours. Well, I determined that
was a bad subprocedure on my part, so I fixed that and it now takes only
about 5 minutes to run.
While doing this doing this I tried a couple of other approaches. I wrote
the data to a table and used CPYFRMIMPF to export it to a CSV, this took
about 1 minute 40. I also wrote a simple Java program to execute an SQL
statement and write the results to a stream file, this took about 1 minute
10. ** Note, there was no scientific approach to the time calculation, just
simple start and end times.
It seems that the invocation of subprocedures in a service program
significantly slows down performance. I invoke 2 subprocedures on each write
to the stream file, a replace all subprocedure and the write line
subprocedure. So, for the question, what kind of overhead is there when
invoking subprocedures from a service program? I'm sure there is information
on this, I just can't seem to find it.
Thanks in advance,
--
James R. Perkins
http://twitter.com/the_jamezp
As an Amazon Associate we earn from qualifying purchases.