Good News Everybody!
The new search engine is LIVE!
Please report any problems to david (at) midrange.com.
|
Hi Lim,
Hmmm...
OK, lets take your procedure prototypes as an example:
d SndMsg PR opdesc
d MsgInId 10 const
d MsgInData 32766 const options(*varsize:*nopass:*omit)
d MsgInType 10 const options(*nopass:*omit )
d MsgFile 10 const options(*nopass:*omit)
d MsgLib 10 const options(*nopass:*omit)
d MsgInQueue 10 const options(*nopass:*omit)
d SndMsgQ PR opdesc
d MsgInQueue 10 const
d MsgInId 10 const
d MsgInData 32766 const options(*varsize:*nopass:*omit)
d MsgInType 10 const options(*nopass:*omit )
d MsgFile 10 const options(*nopass:*omit)
d MsgLib 10 const options(*nopass:*omit)
Within the body of SndMsg you will already have code such as:
d this DS qualified
d msgInId like(MsgInId)
d msgInData like(MsgInData)
d msgInType like(MsgInType)
d msgFile like(MsgFile)
d msgLib like(MsgLib)
d msgInQueue like(MsgInQueue)
/free
this.msgInId = MsgInId;
if %addr(MsgInData) <> *null;
this.msgInData = MsgInData;
else;
this.msgInData = *blanks;
endif;
if %addr(MsgInType) <> *null;
this.msgInType = MsgInType;
else;
this.msgInType = *blanks;
endif;
if %addr(MsgFile) <> *null;
this.msgFile = MsgFile;
else;
this.msgFile = *blanks;
endif;
if %addr(MsgLib) <> *null;
this.msgLib = MsgLib;
else;
this.msgLib = *blanks;
endif;
if %addr(MsgInQueue) <> *null;
this.msgInQueue = MsgInQueue;
else;
this.msgInQueue = *blanks;
endif;
// your internal procedure code here...
return your.opdesc;
/end-free
If you move the code to SndMsgQ you can simply remove the check for
%addr(MsgInQueue) as it is now a required parameter. Everything within
SndMsgQ should work.
Now, in SndMsg your whole procedure code will be relagated to:
p SndMsg b
d SndMsg PR opdesc
d MsgInId 10 const
d MsgInData 32766 const options(*varsize:*nopass:*omit)
d MsgInType 10 const options(*nopass:*omit )
d MsgFile 10 const options(*nopass:*omit)
d MsgLib 10 const options(*nopass:*omit)
d MsgInQueue 10 const options(*nopass:*omit)
d this DS qualified
d msgInId like(MsgInId)
d msgInData like(MsgInData)
d msgInType like(MsgInType)
d msgFile like(MsgFile)
d msgLib like(MsgLib)
d msgInQueue like(MsgInQueue)
/free
this.msgInId = MsgInId;
if %addr(MsgInData) <> *null;
this.msgInData = MsgInData;
endif;
if %addr(MsgInType) <> *null;
this.msgInType = MsgInType;
else;
this.msgInType = *blanks;
endif;
if %addr(MsgFile) <> *null;
this.msgFile = MsgFile;
else;
this.msgFile = *blanks;
endif;
if %addr(MsgLib) <> *null;
this.msgLib = MsgLib;
else;
this.msgLib = *blanks;
endif;
if %addr(MsgInQueue) <> *null;
this.msgInQueue = MsgInQueue;
else;
this.msgInQueue = *blanks;
endif;
return SndMsgQ(this.msgInQueue
:this.msgInId
:this.msgInData
:this.msgInType
:this.msgFile
:this.msgLib);
/end-free
p SndMsg e
So what's changed?
1) You've moved your code from SndMsg to SndMsgQ and removed the check for
MsgInQueue being passed.
2) You've replaced the internal procedure code in SndMsg with a call to
SndMsgQ.
That's it!
You've only got one set of code - now in SndMsgQ.
You've still got your original param checks in SndMsg.
You wont get a signature violation on SndMsg as the prototype hasn't
changed.
You get code in SndMsgQ which you KNOW works.
Cheers
Larry Ducie
This mailing list archive is Copyright 1997-2026 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.