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



Hi Daniel,

Your explanaition seems to be quite to the point, thanks! I didn't think of it this way. The program is just very busy doing nothing, as there were no "C-specs" outside of any procedure and there were only usropn file specifications.
Still... the compiler might notice this IMHO


Kind regards,



Martijn van Breden

lead software architect







________________________________
Van: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> namens Daniel Gross <daniel@xxxxxxxx>
Verzonden: donderdag 31 oktober 2024 16:17
Aan: rpg400-l@xxxxxxxxxxxxxxxxxx <rpg400-l@xxxxxxxxxxxxxxxxxx>
Onderwerp: Re: When ctl-opt main() is missing...

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.



Hi Martjin,

this program works indeed as intended.

If you do not code the "main(..)" keyword, you end up with a "traditional" ILE-RPG program which uses the cycle main "procedure".

This cycle main "procedure" is not enclosed in "dcl-proc/end-proc" and it is normally repeated for every record in a primary or secondary file. The cycle main "procedure" ends, when the last record was processed and the *INLR indicator is *ON when it reached the end of the cycle main "procedure".

But you might have no primary or secondary file - so the LR indicator doesn't switch *ON automatically, so you have to code *INLR = *ON somewhere in the cycle main "procedure".

So if all your code is enclosed inside of "real" procedures, you have effectively an empty cycle main "procedure" - which is repeated until *INLR is *ON ... which never happens - resulting in an endless loop.

And even as the new Power10 processors are really fast - they really just can't finish an endless loop.

HTH and kind regards,
Daniel


Am 31.10.2024 um 15:40 schrieb Martijn van Breden <m.vanbreden@xxxxxxxxxxxxxxxxxxxxxxxxxx>:

Hi all,

I've just helped out a very experienced colleague with a program that just wouldn't run. In debug it halted at **free. It showed status RUN in WrkActJob eaiting quite some CPU. In the call stack it stopped just past program entry point _QRNP_PEP.... We were not even able to force it into an error with the wrong number of parameters.
After a couple of hours testing we found that the ctl-opt main() keyword was missing.

I would say that the compiler should have been able to tell us about this situation or that it could have just ungracefully failed runtime.

Just out of curiosity: is there a reason why a program with this condition does indeed compile and can be called without failing?

Thank you for any shared thoughts


Kind regards,



Martijn van Breden

lead software architect






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

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