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



Yes - linear main procedures are far more efficient in general. At least, if your program doesn't make use of RPG Cycle features, like primary files or something like that.

Generally I like linear main procedures - only if you rely on the standard RPG runtime error handling (like making a Dump when an error occurs) this wouldn't work. Exceptions simply drop thru the linear main procedure as they do in sub procedures. On the other hand - a linear main procedure gives you the on-exit handling, which is by far one of the best features that were introduced recently.

So yes - the Cycle gives the programmer some convenience even if the Cycle isn't used as intended. But linear main procedures are more straightforward.

HTH and kind regards,
Daniel

Am 01.11.2024 um 19:52 schrieb smith5646midrange@xxxxxxxxx:

What is the difference between these (linear vs cycle) from a technical point of view. Is one more efficient than the other or anything? I'm always looking for the "that is cool" bit of knowledge that might be useful down the road.



-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Charles Wilt
Sent: Thursday, October 31, 2024 11:35 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: When ctl-opt main() is missing...

With MAIN() you create a "linear-main" RPG program..
Without it, it's a regular "cycle-main" program.

Charles

On Thu, Oct 31, 2024 at 9:05 AM Jean-Marc DUVAL via RPG400-L < rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:

Hello,

I'm surprised... I never put the MAIN() keyword in my CTL-OPTs.
Just NOMAIN in my SRVPGM.
My programs are compiled in CRTBNDRPG, that's probably the reason. I
never use CRTPGM. Yes, I know, I must go to pure ILE structure but...

-----Message d'origine-----
De : RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> De la part de
Martijn van Breden Envoyé : jeudi 31 octobre 2024 15:40 À :
rpg400-l@xxxxxxxxxxxxxxxxxx Objet : When ctl-opt main() is missing...



ATTENTION : Ce message provient d'une source EXTERNE. Veuillez n'ouvrir
les liens ou pièces jointes que si vous êtes sûr de l'expéditeur.



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://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/rpg400-l__;!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPua2wPyM$
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.com/v3/__https://archive.midrange.com/rpg400-l__;!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPjNwfTYw$
.

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.


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

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.