×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




But the real problem is that no code that contains goto's is so simple and
most goto's would be conditioned
by indicators and then it becomes a mess whatever you do.

On Fri, Jul 21, 2017 at 10:19 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:

On 2017-07-19 5:14 PM, Dan wrote:


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.


If code has downward-only GOTOs to a single TAG, often you can move all
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 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-2026 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.