PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Join the forum, it's quick and easy

PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

SETON LR

3 posters

Go down

SETON            LR Empty SETON LR

Post  rajkumar400 Wed Dec 29, 2010 2:20 am

Why do we use SETON LR in RPG?

can we code a RPG without SETON LR//

Thanks,
Raj


rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

SETON            LR Empty Use of SETON LR

Post  soundhar Wed Dec 29, 2010 11:01 am

Hi,
We can code RPG without SETON LR, by using RETRN ....
WHY SETON LR?
If we use seton LR,the control will transfers to the calling program
(i) By closing the file which is opened in the program.....
(ii) By de-allocating the static variables.....

But if we use RETRN to transfer the control to the calling program,it wont close the file and it wont de-allocate the static variables.....

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  rajkumar400 Wed Dec 29, 2010 11:11 pm

Thanks. raj

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  razuk_r Fri Dec 31, 2010 7:28 pm

Soundar, I have a questions for you. "By closing the file which is opened in the program....." Please clear.

I have a RPGLE program, which has code like below.

EmpDbf I - Input Mode- Keyed access.

-------------
Chain EmpDbf with EmpNo,
Dsply the Employee DEtails.
Set on Lr;
Read EmpDbf; - Is this work or not from this point?
Dow Not EOF
Read EmpPf
Dsply Details.
EndDO
------------



razuk_r

Posts : 65
Join date : 2009-07-31
Location : Chennai

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  soundhar Sat Jan 01, 2011 10:19 pm

sure it will work,chain and read opcodes get executed...
Even u can hv more than one SETON LR also...It wont throw any error for that..
In first C spec itself if u have SETON LR-no problem,it will go upto last C SPEC and then it wil check for termination...
If there is no SETON LR in C Spec or RETRN,it wil throw an error ,the program doesnt know how to end the program


But wherever it sees the Retrn,control transfers to the calling program without closing opened files and without deallocate static variables...

Am i Right,if not correct me Pls....


soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  soundhar Tue Jan 04, 2011 1:09 pm

"By closing the file which is opened in the program....."

ODP-Open Data Path will be deleted...

If a file is opened in a program ,then ODP wil be created b/n program and file.we have to close it...so use SETON LR

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  razuk_r Tue Jan 11, 2011 7:05 pm

Yes, agree Smile

razuk_r

Posts : 65
Join date : 2009-07-31
Location : Chennai

Back to top Go down

SETON            LR Empty Re: SETON LR

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum