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



I must disagree, a return statement in a subroutine exits the program.


Paul Therrien
Andeco Software, LLC
paultherrien@xxxxxxxxxxxxxxxxxx
www.andecosoftware.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Anderson, Kurt
Sent: Monday, November 25, 2013 1:43 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: INLR no longer required?

The Return in your EndProgram is simply telling the procedure to exit
EndProgram, not to end the program. The *InLR is what is triggering the end
of the program when the end of mainline is reached.

This is important because if you're calling EndProgram and thinking it'll
leave the program before executing any more code that follows, you may have
processing occurring that shouldn't.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Michael Schutte
Sent: Monday, November 25, 2013 12:46 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: INLR no longer required?

My guess is that the OP's LR or return is not the last line of the main
proc...

I usually put *INLR and Return in a subprocedure EndProgram.

I once forgot to call that and my program continued to cycle back to the
first line of the program.



On Thu, Nov 21, 2013 at 11:23 PM, Scott Klement
<rpg400-l@xxxxxxxxxxxxxxxx>wrote:

LR has not been required since the RETRN opcode was added to RPG/400,
quite a long time ago.

Several people have stated that all you need is a 'return' in your
program. That's not quite true, the return needs to be in the MAIN
procedure of the module, and you will not need LR. If you don't have
a return in the main procedure (but do have it in subprocedures) that
should still trigger a 'can't see how program would end' compiler error.
LR, however, can be anywhere in the module (LR is global, so it
doesn't matter if it's in a subprocedure.)

If you are writing a nomain or linear-main module, you likewise will
not need either LR or RETURN (except in subprocedures that return
values.)

The fact that you say your program is looping indefinitely makes me
think that this is a cycle-main procedure (i.e. a traditional main
procedure) and that neither LR nor RETURN is occurring. This doesn't
mean, however, that they aren't in the code somewhere... they might be
in some code that's not being called, maybe because it's conditioned,
or something like that.

Either way, this should be easy to fix.


On 11/21/2013 3:17 PM, Englander, Douglas wrote:

We are on V7R1. I just compiled a program that did not reference LR
anywhere. It compiled. I ran it, and it does not stop.

Is this a new enhancement that we can compile RPG programs without LR?
This program does not use primary files either. I was expecting the "I
can't determine how the program ends" error message from the compiler,
but instead got a 00 highest severity message.

Doug

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


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

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


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.