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



Are you opening the file on each invocation of the subprocedures? Are
they usropn?

You can open them once and leave them open and have them automagically
closed at the end if you do something like this....
Thanks to Scott K on this...

///////////////////////////////////////////////////////
D Initialized s 1N inz(*off)

D InzSrvPgm PR
D EndSrvPgm PR
D AgMark 10U 0 options(*nopass)
D Reason 10U 0 options(*nopass)
D Result 10U 0 options(*nopass)
D UserRC 10U 0 options(*nopass)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Initialization routine
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P InzSrvPgm B
D InzSrvPgm PI

D CEE4RAGE PR
D procedure * procptr const
D feedback 12A options(*omit)

/free
if (Initialized);
return;
endif;

// .. open files here ...
// .. other initializations ...

CEE4RAGE(%paddr(EndSrvPgm): *OMIT);

Initialized = *ON;
return;
/end-free
P e
P
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* EndSrvPgm(): This is called automatically when the activation
* group ends. (which is when the srvpgm is removed
* from memory.)
*
* Note that this must be exported so that CEE4RAGE can call it.
*
* InzSrvPgm() registers this procedure with the CEE4RAGE() API
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P EndSrvPgm B export
D EndSrvPgm PI
D AgMark 10U 0 options(*nopass)
D Reason 10U 0 options(*nopass)
D Result 10U 0 options(*nopass)
D UserRC 10U 0 options(*nopass)
/free
if %open(myfile);
close myfile;
endif;

// ... terminate any helper processes
// ... shut down any persistent APIs
// ... close files.
// ... deallocate memory.


Initialized = *OFF;
return;
/end-free
P E


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



James Perkins <jrperkinsjr@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
11/13/2009 01:45 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
cc

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.

This thread ...

Follow-Ups:
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.