Great info!
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of VERNON HAMBERG Owner via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx>
Sent: Friday, November 1, 2024 3:08 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: VERNON HAMBERG Owner <vhamberg@xxxxxxxxxxxxxxx>; rpg400-l@xxxxxxxxxxxxxxxxxx <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: When ctl-opt main() is missing...
The "main" difference :) is that when you use either the MAIN or NOMAIN control-spec keyword, the module is compiled without any of the program cycle code. Therefore, objects will be smaller. That might be the "cool" bit, but there's more - I'm quoting the ILE RPG Reference, now, especially the section called Program Flow in RPG Modules: Cycle Versus Linear.
Another basic thing is that you have to code some things yourself that the cycle used to do for you. So that takes back some of the size benefit - but almost certainly not as much as the full body of code for the cycle.
With either of those keywords, the module is called linear. MAIN has a parameter, the name of the procedure that becomes the PEP, or program entry procedure. With NOMAIN, you can create only a module, not a program. With both of these, you cannot have code related to the cycle. Examples include primary and secondary files, heading, detail and total output, executable calculations, including the *INZSR Initialization subroutine, and *ENTRY PLIST.
You can use, in the main, global, part, things like full-procedural files, I-specs, D-specs, DEFINE, KFLD, KLIST, PARM, and PLIST.
Global files are not implicitly closed, and data areas are not implicitly unlocked.
I hope that wasn't TMI - I admit that in our shop we rarely use either of these keywords. We do use free format often for adding new code and **free for entirely new programs or service programs at times.
Regards
Vern
On Fri, 1 Nov, 2024 at 1:52 PM, smith5646midrange@xxxxxxxxx <smith5646midrange@xxxxxxxxx> wrote:
To: 'rpg programming on ibm i'
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<mailto: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<mailto: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<mailto: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<mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>> De la part de
Martijn van Breden Envoyé : jeudi 31 octobre 2024 15:40 À :
rpg400-l@xxxxxxxxxxxxxxxxxx<mailto: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<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx> To subscribe, unsubscribe, or
change list options,
visit:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l__%3B!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPua2wPyM%24&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210358237%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=6F5gaDm5%2B%2F0%2F94DvxP68cfMaZy8mxBtoPc90lCxnFtY%3D&reserved=0<https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/rpg400-l__;!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPua2wPyM$>
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__https%3A%2F%2Farchive.midrange.com%2Frpg400-l__%3B!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPjNwfTYw%24&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210383766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ywxFL6WYkBdaq66CqJ8%2Fx3PtZMOqbdFV5Bq%2BudS5ehk%3D&reserved=0<https://urldefense.com/v3/__https://archive.midrange.com/rpg400-l__;!!J76aczzK!wJkqMJYl1WEzEgxTkVTdI0tchqFbr48Nbmx90nPrf_8HbVoxPQs4iO1HOIwEJnUSRZd3Cq3pYxda1OeVZ_d02-srJXO983M7QRrPjNwfTYw$>
.
Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto: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<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210396826%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=f8MmRp%2BQFuNJxLoITbxSioFWP%2BTDbEWyP53KROoRaw4%3D&reserved=0<https://lists.midrange.com/mailman/listinfo/rpg400-l>
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210411591%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=NTurXxQEkJHguKmjPGTAp46z2G%2BL4MGXeXE%2BUgVUFGs%3D&reserved=0<https://archive.midrange.com/rpg400-l>.
Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto: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<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210431080%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=vrrTpgRfrfUIMfpe67q8by0%2BHMUAuzUPhyMD4%2B51Qsc%3D&reserved=0<
https://lists.midrange.com/mailman/listinfo/rpg400-l>
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210444221%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=uqyf8Zy56m1V8u2Ae9DAbC%2BG9vaNFuTD9w2mfHVx538%3D&reserved=0<
https://archive.midrange.com/rpg400-l>.
Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto: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<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210459212%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=QUpd5Z%2F8EUnblmePymsVPSlIrLn9unTaUwsXBDM7OEM%3D&reserved=0<
https://lists.midrange.com/mailman/listinfo/rpg400-l>
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210475488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=QEOKBj2ubK7bs%2BMejrMTr8PEPKE1rgVFMzCE6T0uNkA%3D&reserved=0<
https://archive.midrange.com/rpg400-l>.
Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto: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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210489358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=oR8PxkY6Hy%2B2Y0bbBIY9bo%2FYjMbkuWv%2BFPqOprl0g7M%3D&reserved=0<
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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&data=05%7C02%7C%7Cb842cb0349ff4c1088e508dcfab0f98d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638660885210504889%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=E6Rwd6sjs%2FGhdTnTOpACtfAxD9kFsQ%2FY0%2FQyH72yxxM%3D&reserved=0<
https://archive.midrange.com/rpg400-l>.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.