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



Yes, Bob, you can return a variable to CALLPRC. (Took Friday off...)
It's not on the 'P' spec - It's on the 'D' spec, both the PR, and the PI.

This
0024.00 * define prototype and interface
0025.00 D msy017r pr extpgm('MSY017R')
0026.00 D pr_option 1a
0028.00 D msy017r pi *ENTRY PLIST
0029.00 D p_option 1a

Becomes (assuming a 5a return value):
0024.00 * define prototype and interface
0025.00 D msy017r pr 5a extpgm('MSY017R')
0026.00 D pr_option 1a
0028.00 D msy017r pi like(WorkVar) *ENTRY
PLIST
0029.00 D p_option 1
0030.00 D WorkVar s 5a
...
0050.00 return WorkVar;

Try using the wizard in WDSC to create a subprocedure.
However, now that I am thinking of it, you may not be able to do this. At
least with a simple program. You may have to either create a module and
bind the RPGLE module, and a CLLE module together into one program, or,
make your RPGLE module into a service program instead of a program.
Understand? I don't think a simple program supports the return op code on
the main parameter list (it does in subprocedures though).

<snip>
Is there any benefit to putting the D specs in a copy book?
</snip>
The benefits come in validating the parameter list. When you use an
external list from a copy book, and you change the called program, if
someone recompiles the calling program they will get a nasty error at
compile time instead of at execution time. And, compile time is always a
better time to find the error.
Now there's two schools of though on the copy book. One school says to
use a seperate source member in a separate source file
/copy QPROTOSRC,MSY017R
and the other school says to use compiler directives:
/define ProtosOnly
/copy QRPGLESRC,MSY017R
and I forget how to set up the called programs compiler directives and
I've got a lot of catching up to do this morning...

Rob Berendt

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.