*INLR causes files to close and can’t reopen

Tags:
*INLR
*INLR in RPG
AS/400
OS/400
Hi All.. I am a big fan of this website and have been reading the questions posted by many fellow members since recent times and the responses.. Thx to all for all the knowledge sharing .. has been really absorbing.

Well even i have had some of queries related to As400.. Thxful if anyone can help me out.

I have a code as below:

[table width="500"> FPF001 O E K DISK C eval *inlr = *on C EVAL P1ACNO = 17 C WRITE PF001R   [tbody] [/tbody] [/table] Where even after the execution of the *INLR = *ON code the files can be opened and data can be inserted. I had an understanding that after *INLR becomes On, the system closes all the open files and we can no longer open any. Can anyone clarify this please?

 



Software/Hardware used:
OS400
ASKED: August 31, 2010  7:30 AM
UPDATED: September 3, 2010  1:06 AM

Answer Wiki

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

Apologies for the unclear Codes above
Rewritten as below:

<pre>
FPF001 O E K DISK
C eval *inlr = *on
C EVAL P1ACNO = 17
C WRITE PF001R</pre>

===============================================================

<i>I had an understanding that after *INLR becomes On, the system closes all the open files and we can no longer open any.</i>

The question that must be asked in reply is “Where did you get that idea?” Perhaps a source for the idea is in need of clarification.

The LR indicator being on has no effect upon the execution of your program unless you make explicit tests, e.g., IF (*INLR = *ON)…, or unless you are using the RPG “Cycle”.

The effect takes place only after a RETURN is executed. And once you RETURN, you have no opportunity to OPEN any files nor to do anything else with the files — your program has been exited.

Note that LR is intended as a control of “Cycle” code within RPG itself. It doesn’t affect any of your full-procedural code unless you make it so.

And also note that your example program <b>is</b> a “Cycle” program. Because you turned LR on, an exit will happen when you reach the end your code and the PF001 file will be closed at that time. If you chose not to turn LR on, PF001 would be left open.

Tom

Discuss This Question: 1  Reply

 
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
  • philpl1jb
    When your program ends if *INLR is on it will close files that were open by the cycle. If *INLR is off the files aren't closed. But as Tom said, it does nothing until the program is at the end of the RPG cycle .. when it runs out of code, has an error or issues a Return. Phil
    48,575 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