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



David,

Good for you! Keep your procedures short and on-point.

Naming conventions, like all standards, vary from shop to shop.
Personally, I never liked aaannn type conventions, since the numeric
component tells you precisely NOTHING about what this procedure does. I
like to choose names that seem to make sense when you read them in code,
like "Clt_NameIsValid" and "Com_NameIsValid". In use, your code reads
like a book:

If Clt_NameIsValid(in_ClientId)
Process client...
...
Else;
SignalError();
End;

Procedure names can get wordy, but if your shop standards includes a
dictionary of abbreviations, use these (and add to them if needed) to
define common short names. I usually just do this for nouns, not
verbs....

I might recommend that you pick up a copy of Code Complete (Microsoft
Press) by Steve McConnell, which offers some helpful guidelines for
producing quality software.
http://www.esnips.com/doc/07963170-1d2a-48d7-9fba-d52a2deba4c2/Code.Comp
lete.2ed.by.Steve.McConnell.2004.pdf

-Eric DeLong


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Tuesday, June 23, 2009 7:35 AM
To: RPG programming on the IBM i / System i
Subject: Re:Validate client name

Thanks again to all who responded.

Now I might sound a bit picky here but here goes.

Checking that a field has only characters A-Z is not dependant on a
client, so I suddenly had the following brainwave :

Create a new module.

Copy Barbara's code into a function like CheckClientName or something.
For a company name I'll add CheckCompanyName and change the constant
containing the accepted characters.

Profit from the simplicity of this module to persuade the boss to let us
integrate it as our first service program.

I'm already realising, however, that the names of the functions and the
module aren't that easy to think up, bearing in mind that it could be
used universally.

So putting Client into the names of the functions might not be a good
idea. What about the module name? I have to respect a rule of 3
characters and 3 numbers. Should I call it CHR000 or STR000 or TXT000?

Thanks

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.