What will happen if we r using seton lr after return or vice
versa.
Answers were Sorted based on User's Feedback
Answer / naveen chandra joshi
The question asked is:
What will happen if we r using seton lr after return or vice
versa?
Answer: When we use SETON LR after Return, SETON LR will never be executed because before this operation could be performed, Return will send the control back to the called program.
When we use SETON LR before Return then the program will release all the used resources (like open files, variables, any API used, etc) and then return statement will be executed which will send the control back to the called program. I hope your question has been answered.
Regards,
Naveen Chandra Joshi
+91.9891501280
| Is This Answer Correct ? | 14 Yes | 0 No |
Answer / guest
The system return the control from called program to the
calling program when RETURN encounter.Suppose LR is also ON
after the RETURN executed,all resources will be release.
For example,
A program pgm1 call the another pgm2 within a loop,
/free
num=0;
dow not %error;
callp(e) pgm2();
enddo;
/End-free
The pgm2 where the return is executed before LR turned ON
/free
num=num+1;
return;
/End-free
we can see the value of num will be increase all the time
when pgm1 will call the pgm2.
and opposite case:
/free
num=num+1;
*inlr=*on;
return;
/end-free
value of num will be start from zero.
| Is This Answer Correct ? | 13 Yes | 2 No |
Answer / zhang
Renjith, Return opcode will be execute even you have set on
LR. LR just use to clear envirment, but not leave the
program. If you using seton lr after return, I think the
Seton LR will never be processed. Means that the indicates
and file statues will not be reset.
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / sravan
Seton lr is last record indicator when it reaches system will close all the files what are the programs used in the program return the status will be the same
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / renjith
If we use seton LR before return all the files opened will
get closed and program will exit. Return wont get execute.
Likewise in opposite case it wont execute seton LR
| Is This Answer Correct ? | 1 Yes | 20 No |
what is file identifier wher we can use
i have 6 char field in program, but this field is using in all files i want to chage field size as 10 char , how can i do this except using *like defn...?
1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What was the output 2. SETON LR vs RETURN 3. Primary File 4. How to delete a deleted spaces 5. How to read a PF in reverse order in CL 6. I have a object in Lib A, B and C. But it shows in D Lib..Why? 7.
How to set on/off a group of indicators in a single statement?
1.what are the ARITHMETIC EXPRESSIONS IN CL PGM? 2.How to PASSING PARAMETER TO CL PGM?
I have some doubts on subfile----------- -----I wrote a prog on subfile to display the records. Every thing is clear but i defined a field called "opt" as input field in subfile record format from that input field i wish to enter into new screen called "EDIT" which i created it as a separate RCD in display file. i gave opt as 2 for edit just like in WRKMBRPDM screen please telll me the code and how can i code for it in RPG.
I want my simple Green screen should refersh every 1 min ,How can I do it..? Please share the logic
What is the Record Address file. How can we use it in RPG program?
WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?
if there is pf in two libraries and there is a logical file based on the PF, how to find the pf on which the pf is based.
1.How to load Records of a Physical file(PF) in the reverse order, in CL program?
Anyone help me for the below question:- If problem/error occur in *PSSR subroutine,how should I handel it in RPG program.