What you are looking for is a Linear Main program. In a Linear Main program, you specify a subprocedure to be your mainline code using the MAIN control spec keyword.

When your mainline is a subprocedure, on-exit works fine.

Have a look here https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/rzasd/cycvslinear.htm

Brian May
Pre-Sales and Customer Solutions
Profound Logic Software
937-439-7925 Phone
877-224-7768 Toll Free

November 12-14  .  Orlando, FL
Three days of Profound Logic education with our experts!
Register now: info.profoundlogic.com/plus2019

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg Wilburn
Sent: Wednesday, June 26, 2019 1:01 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: ON-EXIT for a Main program

I really like the on-exit for procedures... is there something similar for programs?

I'd rather not code a subroutine with *INLR=*ON and RETURN (along with my other stuff).

I'm looking to call a procedure anytime I need to end the program. I know I could do:

Callp MyProc();

Just wondering if there is a way to do that in ONE line of code.
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@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 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].