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



hhmmmm.  actually, I'll endup with about the same amount of code.  I'll still 
need to check for number of parm, and call SndMsgQ for each *omit fields.



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Lim Hock-Chai
Sent: Tuesday, July 26, 2005 1:29 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: creating a new procedure that call an existing procedure
withoneadditional par


Brilliant!!!

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Larry Ducie
Sent: Tuesday, July 26, 2005 12:03 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: creating a new procedure that call an existing procedure with
oneadditional par


Hi Lim,

<snip>
Question: is there a way for me to utilize the logic in SndMsg with copying 
them to SndMsgQ?
</snip>

Damn hotmail and it's short subject line!

Anyway, here's how I'd do it:

1) Move the code from within SndMsg to SndMsgQ and then call SndMsgQ from 
SndMsg with the params passed to SndMsg re-arranged to suit SndMsgQ.

2) In SndMsg you should pass MsgInQueue as blanks (or a suitable default 
value) to SndMsgQ if %addr(MsgInQueue) = *null.

3) In SndMsgQ you should already be checking for %addr(MsgInType), 
%addr(MsgInType) and %addr(MsgLib) <> *null (or %parms > a certain value) so 
they're already taken care of.  You just need to cater for the MsgInQueue 
value being a default value.

So I would put all of the code in the more restrictive subprocedure, and in 
the less restrictive subprocedures you add default values for the params you 
are not passed but the more restrictive subprocedure requires. Then you 
simply call the more restrictive subprocedure from within your less 
restrictive subprocedure. This way you can create a lot of entry points, but 
one set of code. It also lets you have control over how much data is 
required, and what to do if some isn't passed (set defaults or throw an 
exception).

Cheers

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.