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



I'm sure you meant "duane" for me, and not "Scott" for Scott Klement. We get confused all the time. (hardly)

I'll take a look at your code at a more convenient time. Thanks for making it available.

Just looking at them though, and analyzing them by title alone, they are geared toward general system functions and not toward specific application functions. (I think I said that correctly. my mind is "Friday afternoon muddled".) I will definitely look at them as a means to learn how to create and implement procedures. While my skills are rusty with disuse, I think I have that part down fairly good. (or did at one time.) Maybe when I do get a chance to study it I'll find a better sense of what's bothering me.

Thanks.

duane



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Friday, February 03, 2017 2:34 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Procedure Examples VR7.1

Scott, one thing you might want to look at is my code at www.think400.dk/downloads.htm. There are a series of projects that I wrote and all of them are written using procedures and service programs.

If you look at them you will find service programs like:

1. Standard error handle, XVERRH.
2. User Space XVUSPC,
3. Temp Name XVTMPN.
4. Standard Message Functions XVMSGF
5. Resolve System object - XVRLSV
6. Dynamically Load a Service Program - XVDYNL


On Fri, Feb 3, 2017 at 9:40 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

On Fri, Feb 3, 2017 at 9:54 AM, Duane Scott <dscott@xxxxxxxxxxx> wrote:

getting just the name or phone number of the main contact for that
customer record may not be necessary in but a few. Would a separate
procedure be written just to grab the contact from customer record?


​Is a few more than 1?

So the code required is reusable and rule #1 1. everything that can be
reused, is an external procedure/function in an service program

There's your answer.​ ;)

Consider the following scenario
You've got customer contact info in customer master table. You build
a CUSTOMER_GetContact().

Next year, it's decided that you need to have more than one contact
per customer. It's real easy to move the existing contact to a new
CUSTOMER_CONTACTS table and modify CUSTOMER_GetContact() to accept an
optional CONTACT_TYPE parameter. Without it, it returns the MAIN contact.
But you can also request CONTACT_TYPE = AP.

You don't have to modify or even recompile anything existing that uses
CUSTOMER_GetContact().

Honestly, code doesn't have to be re-used currently to be placed in a
service program. Placing it in a service program to start makes it
reusable in the future. Ideally all your business logic should be in
a service program.

Yeah, it's not going to happen overnight with an existing system. But
when adding enhancements (particularly around new tables) You should
be thinking about how to enable re-use of the new business logic.
When modifying existing logic, particularly logic that's been copied
and pasted into multiple places, take the time to figure out how to
pull it out and into a service program.

Take my new CUSTOMER_CONTRACTS table...I'd have at least
CUSTOMER_ListContacts()
CUSTOMER_CreateContact()
CUSTOMER_UpdateContact()
CUSTOMER_DeleteContact()

The logic to validate a contact (phone number, address, email, ect)
would be in an procedure internal to the CUSTOMER service program and
called by
CUSTOMER_CreateContact() & CUSTOMER_UpdateContact().

An hey next year, when it's decided you need to allow the same contact
info to be used by multiple customers...it's lots easier to move the
contact info into a new CONTACTS table and the old CUSTOMER_CONTACTS
becomes a simple association table with just CUSTOMER_ID, CONTACT_ID, CONTACT_TYPE.

If you haven't seen one of Scott's presentations, take a look at this one.
http://www.scottklement.com/presentations/Pattern%20to%
20Good%20ILE%20with%20RPG.pdf

Charles
--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

CONFIDENTIALITY NOTICE: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact NALC Health Benefit Plan at 703-729-4677 and delete and destroy the original message and all copies

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.