Hi Jerry,
I think, if your goal is to spruce up this code, would be to create your prototypes and PI's, and replace your CALLB's with your new prototyped interface. This eliminates the messy CALLB syntax which does not work with /free (if that is at all important to you).
Re: procedure exports, there should be little need to do more than to add the EXPORT tag to your PI's in the module. Make sure to put your prototypes for all exported procs into a copy member, so that you can easily import these prototypes for use in your application.
Export fields? I really don't like the idea of exporting module data this way. This becomes an "undocumented" interface to the procedures that use this data, and is rarely worth the trouble, imo. This is much like using LDA to pass data between programs in a job. It works, but it's not easy to figure out when problems occur...
Much better to be clear about the exchange of data being passed to a procedure. I have become a fan of template DS to describe custom "data types", say for example "ADDRESS". Address might consists of: NameLine, CareOf, Street1, Street2, City, State, Postal, geocode. Now, for any procedure that manipulates or processes an address can pass the DS as a single data entity (object), and the intent of the proc is crystal clear. Use good naming practices to ensure that your code reads like a story.
Sorry, got off track.
HTH,
-Eric DeLong
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of GKern@xxxxxxxxxxxxxxxx
Sent: Monday, April 11, 2011 2:05 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Eliminating *MODULES with IMPORT and EXPORT parms and replacing them with Service Programs
When my company first started implementing ILE (before I came here), IIRC
IBM had not made their announcement discouraging the use of *MODULEs with
import and export parms (accessed via CALLB). The a few years later IBM
came out in favor of procedures and subprocs (callp, eval) in place of
callb to modules and at that time we stopped developing anything that
would use callb.
We still have a number of modules that do use import and export parms, and
I've been given the go ahead to have the staff start converting all
*modules (including those accessed via callb) into service programs.
My first thought was to simply change the call interface to the module to
make it a prototyped call, using the export fields as parameters.
Then in the programs that do the callb, change the import parms to place
them in a data structure using the same field names and attributes which
would be returned from the (new) service program.
Does anyone have any input regarding how best to go about doing this?
Thanks, Jerry
Gerald Kern - Information Technology
Programming Supervisor
IBM Certified RPG IV Developer
Lotus Notes/Domino 8.0.1 Administrator
The Toledo Clinic, Inc.
4235 Secor Road
Toledo, OH 43623
Phone 419-479-5535
gkern@xxxxxxxxxxxxxxxx
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please inform the
sender by reply e-mail and destroy this and all copies of this message.
--
This is the RPG programming on the IBM i / System i (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.