I believe you will find that RETRN leaves the program open where SETON LR leaves after closing the files and ending the program. You would want to use RETRN if you are calling this progam multiple times from the same calling program, in order to reduce overhead of opening and closing the files each time.
That’s kindof like asking what the difference is between turning a car’s ignition off and setting the parking brake. They are two different operations that have different effects. A more meaningful question would be about the difference between the LR and RT indicators or the difference between RETURN and the RT indicator. Both of those questions would be about comparing directly comparable items.
The difference is that they do two different things. RETURN exits the current procedure and returns to the calling procedure.
SETON LR sets the LR indicator on, and nothing else; the next statement in the program executes just like would happen after setting on any other indicator.
But it’s not what the operations themselves do that’s interesting. It’s the effects on what happens afterward where it gets interesting.
When you execute RETURN, the current procedure is exited and control drops back to the calling procedure (or program). This is effectively the same result as executing the last statement in a procedure and dropping out of the bottom (except in a main procedure, where cycle-processing is in control).
The LR indicator is a flag that controls the types of things that happen when an exit occurs from a main procedure (either because of a RETURN, the RT indicator or from falling through the bottom of a main procedure).
As for what the effects are, there are many of them that might happen. What happens depends on whether LR is set on in a main procedure or a subprocedure (or a *NOMAIN module), whether files were implicitly or explicitly opened or were defined as USROPN, whether compile-time arrays have TOFILE() specified, whether any data areas are defined as ‘UDS’ or not, whether heap storage pointers have been allocated or not, whether it’s a cycle program or not, whether or not an Hx indicator or RT indicator is on or not, etc.
Probably the best thing you can do if you want to understand the ‘difference’ is to download both the ILE RPG Reference and the Programmer’s Guide manuals, open them and do a whole-word, case-sensitive search on “LR”. Then simply go through the search results item by item.
There are too many items of difference to list here.