|
If you get two copies, my apologies, cross posted to the RPG list also.
Scott's original code from the savf on his site. I have put it all back and I still get the error about needing a return
P die B
D die PI
D peMsg 256A const
D SndPgmMsg PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 256A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 32766A options(*varsize)
D dsEC DS
D dsECBytesP 1 4I 0 INZ(256)
D dsECBytesA 5 8I 0 INZ(0)
D dsECMsgID 9 15
D dsECReserv 16 16
D dsECMsgDta 17 256
D wwMsgLen S 10I 0
D wwTheKey S 4A
c eval wwMsgLen = %len(%trimr(peMsg))
c if wwMsgLen<1
c return
c endif
c callp SndPgmMsg('CPF9897': 'QCPFMSG *LIBL':
c peMsg: wwMsgLen: '*ESCAPE':
c '*PGMBDY': 1: wwTheKey: dsEC)
c return
P E
This is from page 76 of 996 of the ILE RPG language reference for V7R1. From what it shows, I think I need the return after the PI section of parameters and then putting that parameter definition into the return statement. I have tried variations and what I am trying doesn't work.
Figure 5 shows a subprocedure, highlighting the different parts of it.
* Prototype for procedure FUNCTION
D FUNCTION PR 10I 0 1
D TERM1 5I 0 VALUE
D TERM2 5I 0 VALUE
D TERM3 5I 0 VALUE
P Function B 2
*-------------------------------------------------------------
* This procedure performs a function on the 3 numeric values
* passed to it as value parameters.
**
This illustrates how a procedure interface is specified for a
* procedure and how values are returned from a procedure.
*-------------------------------------------------------------
D Function PI 10I 0 3
D Term1 5I 0 VALUE
D Term2 5I 0 VALUE
D Term3 5I 0 VALUE
D Result S 10I 0 4
/free
Result = Term1 ** 2 * 17
+ Term2 * 7 5
+ Term3;
return Result * 45 + 23;
/end-free
P E 6
1 A Prototype which specifies the name, return value if any, and parameters
if any. Since the procedure is not exported from this module, it is optional
to specify the prototype.
2 A Begin-Procedure specification (B in position 24 of a procedure
specification)
3 A Procedure-Interface definition, which specifies the return value and
parameters, if any. The procedure interface must match the corresponding
prototype. The procedure-interface definition is optional if the
subprocedure does not return a value and does not have any parameters
that are passed to it. If the prototype had not been specified, the
procedure-interface definition would be used by the compiler to implicitly
define the prototype.
4 Other definition specifications of variables, constants and prototypes
needed by the subprocedure. These definitions are local definitions.
5 Any calculation specifications, standard or free-form, needed to perform
the task of the procedure. The calculations may refer to both local and
global definitions. Any subroutines included within the subprocedure are
local. They cannot be used outside of the subprocedure. If the
subprocedure returns a value, then the subprocedure must contain a
RETURN operation.
6 An End-Procedure specification (E in position 24 of a procedure
specification)
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.