RPGLE Program help

140 pts.
Tags:
RPGLE
RPGLE Program
I have a scenario .. I have program

 

FColstatlf IF   E           k Disk                              FColstatkk O    E             Disk                              F                                                               C                   Read      colstatlf                         C                   Eval      *inlr = *on                       C                   Dow       Not (%Eof(Colstatlf))             C                   Eval      Tablcod = Tablcode                C                   write     rstatre                           C                   Read      Colstatlf                         C                                                               C                   Enddo                                       C                                                               C                   Eval      *inlr = *on                      

 

In the above program i have issued EVAL *INLR = *ON AFTER reading the file COLSTATLF. As i know issuing *INLR =*ON closes all the files. But still the program is working and all the records are written in output file?? Can anyone tell me, how the program is works even though after issuing *INLR =*ON all the files will be closed.???

Answer Wiki

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

Setting on LR does not close any files. All setting on LR does is set on the LR indicator.

The RPG cycle will not not check to see if the LR indicator is on until it gets to the end of your C specs. Therefore, all your C specs will be processed before the LR indicator is checked and any files are closed.

A flow chart of the RPG cycle can be found at:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/books_web/c092508656.htm

Discuss This Question: 5  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
    A while back in one of the iSeries newsletters the writer discussed setting on LR at the top of the program. The idea was that there may be various reasons a progreammer decides to end a program. That way, LR is on whenever the programs ends without needing to code *INLR = *ON mutiple times. Be careful about setting on LR early in the *INZSR subroutine - it can prevent files from opening.
    6,680 pointsBadges:
    report
  • TomLiotta
    Be careful about setting on LR early in the *INZSR subroutine - it can prevent files from opening. I'm not sure where you got that idea. Files are already opened before *INZSR is run. The location of setting on LR can't be earlier than when files are already opened. Tom
    125,585 pointsBadges:
    report
  • BigKat
    Setting on *INLR in *INZSR will cause the program to end at the end of initialization BEFORE any "MainLine" C Specs are run.
    8,220 pointsBadges:
    report
  • Splat
    If you want the program to end after you set on LR, code a Return.
    7,305 pointsBadges:
    report
  • WoodEngineer
    I "got that idea" when my program acted like the SQL statements were not being executed when *INLR was on *INZSR. As soon as I moved setting on *INLR out of *INZSR, everything worked just fine. I think it was BitCat who set me straight on that one.
    6,680 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