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



Thanks Scott. I was hoping you would say that I just wanted to verify.

On the performance, what I am trying to do is hide the database behind
accessor functions. Many times only a few fields are actually needed from a
file and I thought putting those in a service program would cut down on the
number of programs that access these files and make database changes easier
and, hopefully, transparent. I am only chaining the record if it is not
already in memory. My thinking is that if a user is getting many fields
from the service program they will access them for the say key in order. I
am interested in your thoughts on this idea.

Thanks
Chris Bougher



                                                                                
                                                        
                      Scott Klement                                             
                                                        
                      <klemscot@klements        To:       RPG programming on 
the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>                
                      .com>                     cc:                             
                                                        
                      Sent by:                  Subject:  Re: Returning from a 
procedure                                                
                      rpg400-l-bounces@m                                        
                                                        
                      idrange.com                                               
                                                        
                                                                                
                                                        
                                                                                
                                                        
                      05/24/2004 11:39                                          
                                                        
                      AM                                                        
                                                        
                      Please respond to                                         
                                                        
                      RPG programming on                                        
                                                        
                      the AS400 /                                               
                                                        
                      iSeries                                                   
                                                        
                                                                                
                                                        
                                                                                
                                                        





> When you return a value from a procedure are you returning the value or a
> reference to the value?

Assuming that you're referring to data returned by the "return" op-code,
rather than a parameter, you're ALWAYS returning a value.

Even if you return a pointer, you're returning the value of the pointer.
(Though, granted, the address stored in the pointer will likely be used as
a reference.)

> I have several procedures in a service program that are used to access
> different fields in a database and I want to make sure that if I return
the
> database field that it wont change if the service program is used to get
a
> value from a different record. Also I thought about moving the value from
> the field to a work field in the procedure but I was worried the memory
> could be reclaimed.

It won't change, unless you're passing a pointer and basing a variable on
that pointer.  (Or doing something equally obvious, like using the same
variable to store the return value for subsequent calls.)

Your srvpgm may not perform well -- depending on the fields and how often
you're doing this -- but then, that may not be one of your goals.

_______________________________________________
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-Ups:

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.