|
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Simon Coulter
New procedure: validateName( validateThis : withThat )
This has the body of the code and performs the
validation giving a result that indicates whether validation
was successful (this could be simple TRUE/FALSE or a number
indicating the position of the first invalid character in
which case 0 would be all OK). This procedure MAY be exported
but I probably wouldn't do that. This will be a private
procedure used only within the module.
What if I want to do the same with my addresses which are treated in a separate module?
New procedure: validateClientName( name )
calls validateName( name : CLIENT_CONSTANT )
New procedure: validateCompanyName( name : CLIENT_CONSTANT )
calls validateName( name : CLIENT_CONSTANT )
I'd then have something like
New procedure: validateAddressStreet( street : ADDRESS_CONSTANT )
calls validateAdress( Address : ADRESS_CONSTANT )
Wouldn't I end up with another function validateAddress identical to validateName? In fact, isn't validateName just encapsulating the %CHECK BIF?
Why not therefore, instead of
validatClientName ( name ); which is self documenting,
// Validate client's name.
%CHECK ( ClientName : CLIENT_NAME_CHARACTERS ); with a comment.
I hope I'm not missing the plot.
--
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.
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.