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



 IMO there is a right way and a wrong way to do "encapsulating file access"
in RPG.  For one thing I would immediately rename the approach to
"encapsulating business processes for reuse" so staff doesn't get the wrong
impression of the end goal. 

My first attempt at creating file I/O wrappers came about because of my
introduction to Java and it's approach to guarding class variables by
putting a getter and setter in front of everything. The reasons I was told
Java did this was so that you would always have control of what the value
was being set to or so that you could massage the data as it left the class
with the getter routine. Note that the getter and setter methods in Java are
not there for providing database I/O separation but rather because a
community has created an unwritten rule that states getters and setters are
how you program in Java.

So my recommendation would not be to create file I/O wrappers but instead
find places where you are repeating same processes and model those into a
reusable service program with appropriate sub procedures.  A case in point
would be the process of getting the price for a product. Usually there are
many variables involved in obtaining an item's price and there are many
places where it is needed (Order Entry in house, Online Shopping Basket,
EDI, Quotes, etc). If the pricing routine is designed appropriately you
should be able to hide the complexities of the database I/O and all
corresponding business logic into a few sub procedure calls and reuse it for
each application set within your company.

You have to remember that in the end you are trying to save time. Going to a
low-level approach is not going save time unless all of the code is
generated for you and RPG just isn't suited for file I/O code generation
without crippling the ease of use we have with native I/O. Finding the right
mix will take a few trial and errors because there will be some programs the
become way to bulky and others will be so low-level that it takes a couple
programmers just to do the monotonous work of typing them in.

HTH,
Aaron Bartell


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Cate, Tony (Alliance)
Sent: Friday, November 25, 2005 12:01 PM
To: RPG programming on the AS400 / iSeries
Subject: File encapsulation


Our group is thinking about encapsulating file access in service programs.
Concerns have been voiced about the impact on performance such a move would
have.

Does anyone out there have practical experience with this technique that
they would be willing to share? 

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

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.