The way I read/understand Barbara's post..

Basically the binding to a local sub-proc is done by the RPG compiler when
the *MODULE is created.

Since the compiler didn't recognize the PR as one for a local sub-proc, it
left it unbound in the *MODULE for the binder step to take care of.

Since the symbol wasn't exported, the binder couldn't find it. Thus the
reason adding EXPORT "fixed" the problem.

And yes, without an explicit PR, the RPG compiler generates global PR for
sub-procs.

Charles

On Fri, Nov 13, 2020 at 5:48 AM Brian Parkins <goodprophet.bp@xxxxxxxxx>
wrote:

Thanks for clarifying, Barbara. But I am still a little unclear why the
local prototype for PROC2 does work if I EXPORT the subprocedure? (I
thought EXPORT only influenced what is "visible" outside the *MODULE.)

BTW, I assume the absence of PR and PI works (below) because RPG
generates global definitions within the *MODULE?

**Free
Ctl-Opt DftActGrp(*No) ActGrp(*New) Main(Proc1);
Dcl-Proc Proc1;
// Main Entry procedure
Dsply 'In main Proc' '*REQUESTER';
Proc2();
Return;
End-Proc;
Dcl-Proc Proc2;
// Internal subprocedure
Dsply 'In Proc2' '*REQUESTER';
End-Proc;

Appreciate your help!
Brian

On 13/11/2020 11:36, Barbara Morris wrote:
Brian, as others have suggested, the problem is that the prototype for
Proc2 is coded as a local prototype in your main procedure. RPG only
recognizes a prototype as being the prototype for a local procedure
when the prototype is in the global definitions of the module.

--
Barbara

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.