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



Rory,

I find that if I "dumb down" the interface with a wrapper, pretty soon I have 5 or 10 wrappers lying around to fulfill the needs that the other wrappers don't. With the copybooks I created everything needed for the API is defined and defaulted.
So for QMhSndPm, when used in a display program, all I do is include the DQMhSndPm copybook in the Dspecs of the procedure (or module if I want it to be global).
Then I include the ZQMhSndPm copybook where I am initializing the procedure/program. The initializing copybook is smart enough not to allocate new storage if storage has already been allocated.
When I want to send a message I set the message Id and the message data and send the message. By default the message is sent as *INFO to the caller. If I want to throw an exception I just change the message type to *ESCAPE and the joblog will reflect the program, procedure, line of the QMhSndPm API call which helps immensely finding the problem(s)

Because I have the full API interface available I can use the defaults or the full API without having multiple interfaces to the API.

There are two problems that I have with the copybook approach, several of the copybooks are decades old and are coded with the requirements of their day. Updating the copybooks can be difficult when you have thousands of programs using them. I am slowly redesigning the more archaic of these copybooks, QMhSndPm is one of them but it is embedded in the most number of programs so I am saving it till last.



Duane Christen

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rory Hewitt
Sent: Monday, December 22, 2008 8:13 PM
To: RPG programming on the IBM i / System i
Subject: Re: Question about prototyping

Duane,

Are you saying that you *don't* like using wrappers to dumb
down API interfaces? I would have thought dumbing things down
is an excellent idea...
Much better to have a sndPgmMsg() with parameters in a
'useful' order and with lots of them be optional than have to
call QMHSNDPM passing all the parameters, surely?

I'm a big proponent of creating API wrappers (in fact, I
wrote an article about it a couple of years ago -
http://systeminetwork.com/article/api-wrapping-examples).

Rory

On Mon, Dec 22, 2008 at 11:12 AM, Christen, Duane J. <
Duane.Christen@xxxxxxxxxxxxx> wrote:

There is no way, using QMhSndPm, to have the sending program be
anything other than the caller of the API, which is one
reason we use
copybooks to define the API interface. The other is I HATE
wrappers to
"dumb down" an API interface.

Duane Christen

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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________


NOTICE: This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying, or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail.

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.