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



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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.