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



On 9/26/2012 9:28 AM, Vernon Hamberg wrote:

So to clarify about initialization - and I did look at the reference and
programmer's guide just now - when using MAIN, the extra initialization
for the cycle doesn't happen. You can't even HAVE an *INZSR, as I
understand.

That's correct. Part of the *INIT part of the cycle is used even for no-main and linear-main modules, but it's only done once per activation group, the first time any procedure in the module gets called. So global data gets initialized, global files get implicitly opened, but that's all.


I assume that data declared in the MAIN subprocedure is initialized
every time it is called, unless declared as STATIC.

Yes, the main subprocedure behaves exactly the same as any RPG subprocedure.


So what happens with global data? If running in *DFTACTGRP? Or is that
not possible with a linear-main module? I did see the section on module
initialization, with the subtopic on global data. But it wasn't clear
what happens with global data when there is no cycle initialization.

*DFTACTGRP is possible. In that case, the module would be initialized once in the job, and never again.


Maybe, too, this is a stimulus to avoiding global data and passing it
along in parameters from the MAIN subprocedure, eh?

True. Being able to pass files around allows you to even avoid global files. But I wouldn't go so far as to say that module-level global data and files are necessarily to be avoided.


I have to find a few minutes to try out some stuff, I can see that!


Yep, the best way I know to learn about stuff is by trying it out.


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.