SetON LR and Return

10 pts.
Tags:
RPG
SETON
What is the difference between Seton LR And Return

Answer Wiki

Thanks. We'll let you know when a new response is added.

*INLR = *on files and resources are released
Return ends the program returning to calling program.
Return without *INLR = *On resources remain locked until job ends or this program is recalled and changes the value of *INLR.

————————————————
WoodEngineer’s correct – saves resources to leave *INLR off, keep in mind that initialization and *INZSR do not run on subsequent calls.
Phil

_____________________________________

Another important difference is that setting on LR ends the called program when the cycle ends, but using RETURN returns control to the calling program immediately. Therefore after LR is on, you can still continue processing additional commands.

Graybeard52

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WoodEngineer
    If program A calls program B many times, you can speed up the process by not setting on *INLR in B until A is ready to end. Then A is ready to end, issue one more call to B with a parm that tells B it is time to shut down.
    6,875 pointsBadges:
    report
  • Pravs
    in Seton LR release the resources and close the files after that why commands are executed. commands should not execute. Please share the exact reason.............?????
    20 pointsBadges:
    report
  • pdsathishkumar
    Opened files are closed when exiting with LR equal to ON. Opened files remain open when using RETURN with LR equal to OFF, and the program is still resident (potentially active.) but we can't able to come out from RPG program without using the both op-code...
    3,790 pointsBadges:
    report
  • TomLiotta
    commands should not execute. Why not? "Commands" are from CL, but "SETON LR" is from RPG. Those are two separate languages, so one isn't going to affect the other. (...with some exceptions based in multiple modules...) "SETON LR" in a RPG program won't affect "commands" from a CL program. They're different programs. Tom
    125,585 pointsBadges:
    report
  • graybeard52
    Seton LR just turns on an indicator that tells the program to end at the end of the RPG cycle. So RPG commands CAN execute after LR is turned on, in fact, its often desirable to do some end of file proessing. To get out immediately, SETON LR, then do a RETURN on the next line.
    3,115 pointsBadges:
    report
  • TomLiotta
    ...its often desirable to do some end of file proessing. Yep. I've seen it set on during initialization routines. It simply helps ensure that it will be on no matter how early a return from the program. Tom
    125,585 pointsBadges:
    report
  • WoodEngineer
    One tip about setting on LR early in your program . . . don't do it in *INZSR. This will cause your program to end prematurely.
    6,875 pointsBadges:
    report
  • TomLiotta
    . . . don’t do it in *INZSR. Good point. I should have differentiated between "initialization routines" in non-cycle coding and use of an actual *INZSR routine. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following