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



Ah.. ok. I always choose a procedure instead of a subroutine for this kind
of validation because I find that I often have to use one or more work
variables during the course of processing. By using a procedure, I can keep
those work variables local. As a side benefit, it also allows me to use the
code in an expression, ie:

if validData();
   doSomething();
endif;


John Taylor


> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx 
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christen, Duane J.
> Sent: Thursday, July 28, 2005 10:04 AM
> To: 'RPG programming on the AS400 / iSeries'
> Subject: RE: dRE: No Subroutines (was Re: Debugging many 
> subprocedures)
> 
> Sorry John;
> 
> (Trying to trim down the messages and trimmed to much.)
> 
> The code was your validateInput procedure example.
> 
> 
> validateInput b
>                   pi          n
> 
>       if field1 = 'bad';
>          msgData = "Field 1 must not be bad";
>          exsr sndDiagMsg;
>       endif;
> 
>       if field2 = 'bad';
>          msgData = "Field 2 must not be bad";
>          exsr sndDiagMsg;
>       endif;
> 
>       (continue for each additional field)
> 
>       return (%len(msgData) = 0);
> 
>   begSr sndDiagMsg;
>       QMHSNDPM( 'CPF9897'
>                :'QCPFMSG    QSYS'
>                  :msgData
>                :%len(msgData)
>                :'*DIAG'
>                :'*'
>                :1
>                :msgKey
>                :dsERR ); 
> 
>   endSr;
> validateInput         e
> 


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.