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



Interesting Brian,

Perhaps Barbara will pop-in and explain (or tell us it is a bug) - but the "cure" is to remove your proto for the Msg() routine. I never code those anyway since they became optional so it is not a situation I would normally encounter.

Remove the Pr and the bind error disappears and all works as expected.


Jon P.



On May 15, 2024, at 4:23 AM, Brian Parkins <goodprophet.bp@xxxxxxxxx> wrote:

OK, here is something I have never quite understood. Can anyone explain why subprocedures within a Linear Main *MODULE have to be EXPORTed - even when only referenced within the same *MODULE?

Example: A single source member follows, (please be gentle with my coding.) CRTBNDRPG used with this particular example.
**Free
// Linear Main *MODULE with subprocedure
// Subprocedure MSG requires EXPORT keyword - why???
Ctl-Opt DftActGrp(*No) Main(MainProc);
Dcl-PR MainProc ExtPgm('PGM2_PROC1');
End-PR;
Dcl-Proc MainProc;
Dcl-PI MainProc;
End-PI;
Dcl-PR Msg;
End-PR;
Dcl-S UserId Char(10) Inz(*USER);
Dsply 'In MainProc' UserId;
Msg();
Return;
End-Proc;

Dcl-Proc Msg Export;
Dcl-PI Msg;
End-PI;
Dcl-S UserId Char(10) Inz(*USER);
Dsply 'In Msg Proc' UserId;
Return;
End-Proc;

If I rewrite the above as a Cycle Main *MODULE, the EXPORT keyword is not required on the subprocedure. The RPG Reference states:
"If the EXPORT keyword is not specified, the procedure can only be called from within the module."
So why is EXPORT needed in the above example? (If it is removed, a bind error occurs.)

Thx for any insight.
Brian.
--
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.



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.