|
On 2017-07-19 5:14 PM, Dan wrote:
If code has downward-only GOTOs to a single TAG, often you can move all
Any new code I add to existing programs is free-format, and it's not
unusual that a GOTO is required in the middle of it because of the way the
rest of the code is architected. I'm just glad we don't need the /free &
/end-free directives any longer, cuz that would be really ugly.
the code containing the GOTOs and the TAG into a subroutine and then use
LEAVESR instead of the GOTOs.
some irrelevant code A.
some code B.
C goto endtag
some more code C.
C goto endtag
yet more code D.
C endtag tag
some more irrelevant code E.
Change to
some irrelevant code A.
exsr do_whatever;
some more irreievant code E.
begsr do_whatever;
some code B.
leavesr; // was goto endtag
some more code C.
leavesr; // was goto endtag
yet more code D.
endsr; // was endtag tag
I think the only time there's no other way around coding a TAG statement
is for the SQL WHENEVER statement.
--
Barbara
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
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.